Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade project Aravis0.8 #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ADDN=Camera.cpp

INCLUDES= -I<PATH TO ARAVIS SRC>aravis/src/ -I/usr/include/glib-2.0/ -I/usr/lib/x86_64-linux-gnu/glib-2.0/include

LINKAGES=-L/usr/lib -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/ -L<PATH TO ARARVIS SRC>/aravis/src/.libs/ -laravis-0.6 -lglib-2.0 -lm -pthread -lgio-2.0 -lgobject-2.0 -lxml2 -lgthread-2.0 -lglib-2.0 -lz -lusb-1.0 -lpng
LINKAGES=-L/usr/lib -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/ -L<PATH TO ARARVIS SRC>/aravis/src/libaravis-0.8.so -laravis-0.8 -lglib-2.0 -lm -pthread -lgio-2.0 -lgobject-2.0 -lxml2 -lgthread-2.0 -lglib-2.0 -lz -lusb-1.0 -lpng

PKGS=`pkg-config --cflags --libs opencv`

Expand Down
26 changes: 13 additions & 13 deletions src/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Camera::Camera(bool automode){

arv_g_type_init();
// captures NULL env camera. if fake-enabled captures Aravis-GV01 (running at 127.0.0.1)
camera = arv_camera_new(NULL);
camera = arv_camera_new(NULL, &error);
if(camera != NULL){
std::cout << "Initialized ArvCamera@"<<camera << std::endl;
std::cout << "AUTO Prop Mode : " << automode << std::endl;
Expand All @@ -29,7 +29,7 @@ Camera::Camera(std::string camera_id, bool automode){
*/

arv_g_type_init();
camera = arv_camera_new(camera_id.c_str());
camera = arv_camera_new(camera_id.c_str(), &error);
if(camera != NULL){
std::cout << "Initialized ArvCamera@"<<camera << std::endl;
std::cout << "AUTO Prop Mode : " << automode << std::endl;
Expand All @@ -44,48 +44,48 @@ Camera::Camera(std::string camera_id, bool automode){

void Camera::disable_auto(){
printf("Disable Auto Property\n");
arv_camera_set_exposure_time_auto(camera, ARV_AUTO_OFF);
arv_camera_set_gain_auto(camera, ARV_AUTO_OFF);
arv_camera_set_exposure_time_auto(camera, ARV_AUTO_OFF, &error);
arv_camera_set_gain_auto(camera, ARV_AUTO_OFF, &error);

// write support for other properties
}

void Camera::setProperties(std::string property_name, double property_value){
if(property_name == "GAIN"){
arv_camera_set_gain(camera, property_value);
arv_camera_set_gain(camera, property_value, &error);
}else if(property_name == "EXP_TIME"){
arv_camera_set_exposure_time(camera, property_value);
arv_camera_set_exposure_time(camera, property_value, &error);
}else if(property_name == "FPS"){
arv_camera_set_frame_rate(camera, property_value);
arv_camera_set_frame_rate(camera, property_value, &error);
}
return ;
}

void Camera::setTrigger(bool val){
issetTrigger = val;
if(val){
arv_camera_set_trigger(camera, "Line1");
arv_camera_set_trigger(camera, "Line1", &error);
}
}

void Camera::start_video(int buffer_queue_size){

std::cout << "ARV Camera Check " << camera << std::endl;
stream = arv_camera_create_stream(camera, NULL, NULL);
stream = arv_camera_create_stream(camera, NULL, NULL, &error);
std::cout << "ARVSTREAM stream created at "<< stream << std::endl;
std::cout << "Buffer Queue Size set at " << buffer_queue_size << std::endl;
if( stream == NULL){
printf("STREAM CREATION ERROR.\n");
return;
}
gint payload = arv_camera_get_payload(camera);
gint payload = arv_camera_get_payload(camera, &error);
if(issetTrigger){
buffer_queue_size = 1;
}
for(int i=0; i < buffer_queue_size; i++){
arv_stream_push_buffer(stream, arv_buffer_new(payload, NULL));
}
arv_camera_start_acquisition(camera);
arv_camera_start_acquisition(camera, &error);

usleep(1);

Expand Down Expand Up @@ -144,6 +144,6 @@ cv::Mat Camera::readFrameMat(){


void Camera::disconnect(){
arv_camera_stop_acquisition(camera);
arv_camera_stop_acquisition(camera, &error);

}
}
3 changes: 2 additions & 1 deletion src/Camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Camera{
ArvStream *stream = NULL;
ArvBuffer *buffer = NULL;
ArvBuffer *_buffer = NULL;
GError *error = NULL;
void* framebuffer;
bool issetTrigger = false;

Expand All @@ -34,4 +35,4 @@ class Camera{



};
};