Skip to content
Snippets Groups Projects
Commit e4649939 authored by am0ebe's avatar am0ebe
Browse files

.

parent 09360a19
Branches
Tags
No related merge requests found
this is part of the CAMTRON Project. COdename: Software A
this is part of the CAMTRON Project. Codename: Software B
Based of Vimba SDK from:
....
https://www.alliedvision.com/en/products/vimba-sdk/
-> expanded on VimbaCPP/Example/AsyncOpenCVRecorder !
-> main software is in ./recorder!
used to acquire images and store them as jpeg along with timestamps
......@@ -235,6 +235,33 @@
},
"buffers":
[
{
"file": "Source/ListCameras.h",
"settings":
{
"buffer_size": 1869,
"line_ending": "Windows"
}
},
{
"file": "Source/ListCameras.cpp",
"settings":
{
"buffer_size": 5414,
"line_ending": "Windows"
},
"undo_stack":
[
]
},
{
"file": "Source/program.cpp",
"settings":
{
"buffer_size": 1894,
"line_ending": "Windows"
}
}
],
"build_system": "Packages/Makefile/Make.sublime-build",
"build_system_choices":
......@@ -336,6 +363,8 @@
},
"expanded_folders":
[
"/home/sugu/code/idiv/camtron_all/b/VimbaCPP/Examples/ListCameras",
"/home/sugu/code/idiv/camtron_all/b/VimbaCPP/Examples/ListCameras/Source"
],
"file_history":
[
......@@ -470,7 +499,7 @@
],
"find":
{
"height": 34.0
"height": 46.0
},
"find_in_files":
{
......@@ -665,6 +694,100 @@
{
"sheets":
[
{
"buffer": 0,
"file": "Source/ListCameras.h",
"semi_transient": false,
"settings":
{
"buffer_size": 1869,
"regions":
{
},
"selection":
[
[
0,
0
]
],
"settings":
{
"syntax": "Packages/C++/C++.sublime-syntax",
"tab_size": 2,
"translate_tabs_to_spaces": true
},
"translation.x": 0.0,
"translation.y": 450.0,
"zoom_level": 1.0
},
"stack_index": 2,
"stack_multiselect": false,
"type": "text"
},
{
"buffer": 1,
"file": "Source/ListCameras.cpp",
"selected": true,
"semi_transient": false,
"settings":
{
"buffer_size": 5414,
"regions":
{
},
"selection":
[
[
1657,
1657
]
],
"settings":
{
"syntax": "Packages/C++/C++.sublime-syntax",
"tab_size": 4,
"translate_tabs_to_spaces": true
},
"translation.x": 0.0,
"translation.y": 675.0,
"zoom_level": 1.0
},
"stack_index": 0,
"stack_multiselect": false,
"type": "text"
},
{
"buffer": 2,
"file": "Source/program.cpp",
"semi_transient": true,
"settings":
{
"buffer_size": 1894,
"regions":
{
},
"selection":
[
[
1427,
1427
]
],
"settings":
{
"syntax": "Packages/C++/C++.sublime-syntax",
"tab_size": 2,
"translate_tabs_to_spaces": true
},
"translation.x": 0.0,
"translation.y": 375.0,
"zoom_level": 1.0
},
"stack_index": 1,
"stack_multiselect": false,
"type": "text"
}
]
}
],
......@@ -719,7 +842,7 @@
"project": "ListCameras.sublime-project",
"replace":
{
"height": 64.0
"height": 84.0
},
"save_all_on_build": true,
"select_file":
......@@ -755,7 +878,7 @@
[
[
"",
"~/vimba_5_1/VimbaCPP/Examples/AsynchronousGrab/Qt/Source/AsynchronousGrab.sublime-project"
"~/code/idiv/camtron_all/b/recorder/recorder.sublime-project"
]
],
"width": 380.0
......
File added
File added
File added
#include "VimbaCPP/Include/VimbaCPP.h"
#include <iostream>
#include <vector>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <QApplication>
using std::cout;
using std::endl;
using namespace AVT::VmbAPI;
// read_and_display_img("/home/sugu/code/c++/opencv_quark/starry_night.png"); //make HOME user independent
int read_and_display_img( cv::String img_with_path )
{
std::vector<int> vec;
cv::Mat image;
image = imread(img_with_path, cv::IMREAD_COLOR); // Read the file
if( image.empty() ) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
namedWindow( "Display window", cv::WINDOW_AUTOSIZE ); // Create a window for display.
imshow( "Display window", image ); // Show our image inside it.
cv::waitKey(0); // Wait for a keystroke in the window
return 0;
}
int main(int argc, char const *argv[])
{
QApplication a( argc, argv );
exit(12);
VimbaSystem &sys = VimbaSystem::GetInstance (); // Create and get Vimba singleton
VmbVersionInfo_t version;
sys.QueryVersion(version);
cout << "# Vimba API Version: " << version.major << "." << version.minor << "." << version.patch << endl;
//print Qt and OpenCV Version!
CameraPtrVector cameras;
if ( VmbErrorSuccess == sys.Startup() )
{
sys.GetCameras( cameras );
if ( VmbErrorSuccess == sys.GetCameras ( cameras ) )
{
cout << "found " << cameras.size() << " cameras" << endl;
for ( auto iter = cameras.begin (); cameras.end () != iter; ++ iter )
{
if ( VmbErrorSuccess == (* iter)->Open( VmbAccessModeFull ) )
{
std::cout << " Camera opened " << std::endl;
std::string str;
(*iter)->GetID( str );
std::cout << " Id: " << str << std::endl;
(*iter)->GetName( str );
std::cout << " name: " << str << std::endl;
(*iter)->GetModel( str );
std::cout << " model: " << str << std::endl;
(*iter)->GetSerialNumber( str );
std::cout << " serial: " << str << std::endl;
// (*iter)->GetPermittedAccess( VmbAccessModeType& );
// std::cout << " model: " << str << std::endl;
(*iter)->GetInterfaceID( str ); //name/id of connected IF
std::cout << " interfaceID: " << str << std::endl;
}
}
}
else
{
cout << "Couldn't get cameras" << endl;
}
sys.Shutdown(); //unload TLs
}
else
{
cout << "Couldn't initialize API" << endl;
}
return 0;
}
// }}
{
"folders":
[
{
"path": "..",
"name": "b"
},
{
"path": ".",
},
{
"path": "../../dox",
"name": "dox"
},
]
}
//build sys @ ~/.config/sublime-text/Packages/User/C++.sublime-build
#include "VimbaCPP/Include/VimbaCPP.h"
#include "VimbaC/Include/VimbaC.h"
#include "VimbaCPP/Include/Frame.h"
// #include "Vimba.h"
namespace AVT {
namespace VmbAPI {
// Constructor for the FrameObserver
class FrameObserver::FrameObserver( CameraPtr pCamera ) : IFrameObserver ( pCamera ){}
// Frame callback notifies about incoming frames
void FrameObserver::FrameReceived ( const FramePtr pFrame )
{
// Send notification to working thread
// Do not apply image processing within this callback ( performance )
// When the frame has been processed , requeue it
m_pCamera -> QueueFrame ( pFrame );
}
void Vimba::RunExample (void)
{
VmbInt64_t nPLS; // Payload size value
FeaturePtr pFeature ; // Generic feature pointer
VimbaSystem &sys = VimbaSystem :: GetInstance (); // Create and get Vimba singleton
CameraPtrVector cameras ; // Holds camera handles
CameraPtr camera ;
FramePtrVector frames (15); // Frame array
// Start the API , get and open cameras
sys.Startup (); // = VmbErrorSuccess?
sys.GetCameras( cameras ); // = VmbErrorSuccess?
camera = cameras [0]; //iterate over all cams -> auto it = cameras.begin()... (*iter)->GetName( name )==success
camera ->Open( VmbAccessModeFull );
// Get the image size for the required buffer
// Allocate memory for frame buffer
// Register frame observer / callback for each frame
// Announce frame to the API
camera -> GetFeatureByName (" PayloadSize ", pFeature );
pFeature -> GetValue (nPLS );
for( FramePtrVector :: iterator iter= frames .begin (); frames .end () != iter; ++ iter)
{
(* iter ).reset(new Frame (nPLS));
(* iter)-> RegisterObserver ( IFrameObserverPtr (new FrameObserver ( camera )));
camera -> AnnounceFrame (* iter );
}
// Start the capture engine (API)
camera -> StartCapture ();
for( FramePtrVector :: iterator iter= frames .begin (); frames .end ()!= iter; ++ iter)
{
// Put frame into the frame queue
camera->QueueFrame (* iter );
}
// Start the acquisition engine ( camera )
camera -> GetFeatureByName (" AcquisitionStart ", pFeature );
pFeature -> RunCommand ();
// Program runtime , e.g., Sleep (2000);
// Stop the acquisition engine ( camera )
camera -> GetFeatureByName (" AcquisitionStop ", pFeature );
pFeature -> RunCommand ();
// Stop the capture engine (API)
// Flush the frame queue
// Revoke all frames from the API
camera -> EndCapture ();
camera -> FlushQueue ();
camera -> RevokeAllFrames ();
for( FramePtrVector :: iterator iter= frames .begin (); frames .end ()!= iter; ++ iter)
{
// Unregister the frame observer / callback
(* iter)-> UnregisterObserver ();
}
camera ->Close ();
sys.Shutdown (); // Always pair sys. Startup and sys. Shutdown
}
}} // namespace AVT :: VmbAPI
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment