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

Update/official aravis intergration #301

Merged
merged 3 commits into from
Aug 1, 2024
Merged
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
16 changes: 8 additions & 8 deletions example/u3v_fake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@ int main(int argc, char *argv[])

std::vector< int > buf_size = std::vector < int >{ width, height};

std::vector<Halide::Buffer<uint8_t>> output;
std::vector<Halide::Buffer<uint8_t>> outputs;
std::vector<Halide::Buffer<uint32_t>> frame_counts;
for (int i = 0; i < num_device; ++i){
output.push_back(Halide::Buffer<uint8_t>(buf_size));
outputs.push_back(Halide::Buffer<uint8_t>(buf_size));
frame_counts.push_back(Halide::Buffer<uint32_t>(1));
}
n["output"].bind(output);
Buffer<uint32_t> frame_count(1);
n["frame_count"].bind(frame_count);
n["output"].bind(outputs);
n["frame_count"].bind(frame_counts);


// Obtain image data continuously for 100 frames to facilitate operation check.
// Obtain image data
int user_input = -1;
while(user_input == -1)
{
Expand All @@ -75,12 +76,11 @@ int main(int argc, char *argv[])
// Depends on sensor image pixel format, apply bit shift on images
// Display the image
for (int i = 0;i<num_device;i++){
cv::Mat img(height, width, CV_8UC1, output[i].data());
cv::Mat img(height, width, CV_8UC1, outputs[i].data());
cv::imshow("Fake Camera" + std::to_string(i), img);
}

user_input = cv::waitKeyEx(1);
std::cout<<frame_count(0)<<std::endl;
}

cv::destroyAllWindows();
Expand Down
28 changes: 7 additions & 21 deletions src/bb/image-io/rt_u3v.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ class U3V {

using arv_device_is_feature_available_t = bool(*)(ArvDevice*, const char*, GError**);

using arv_device_get_register_feature_length_t = uint64_t(*)(ArvDevice*, const char*, GError**);
using arv_device_get_register_feature_value_t = void(*)(ArvDevice*, const char*, uint64_t, void*, GError**);
using arv_device_dup_register_feature_value_t = void*(*) (ArvDevice*, const char *, uint64_t *, GError **);

using arv_device_create_stream_t = ArvStream*(*)(ArvDevice*, ArvStreamCallback*, void*, GError**);

Expand Down Expand Up @@ -381,8 +380,7 @@ class U3V {
GET_SYMBOL(arv_device_get_integer_feature_bounds, "arv_device_get_integer_feature_bounds");
GET_SYMBOL(arv_device_get_float_feature_bounds, "arv_device_get_float_feature_bounds");

GET_SYMBOL(arv_device_get_register_feature_length, "arv_device_get_register_feature_length");
GET_SYMBOL(arv_device_get_register_feature_value, "arv_device_get_register_feature_value");
GET_SYMBOL(arv_device_dup_register_feature_value, "arv_device_dup_register_feature_value");

GET_SYMBOL(arv_device_create_stream, "arv_device_create_stream");
GET_SYMBOL(arv_buffer_new_allocate, "arv_buffer_new_allocate");
Expand Down Expand Up @@ -501,9 +499,7 @@ class U3V {
arv_device_get_float_feature_bounds_t arv_device_get_float_feature_bounds;

arv_device_is_feature_available_t arv_device_is_feature_available;

arv_device_get_register_feature_length_t arv_device_get_register_feature_length;
arv_device_get_register_feature_value_t arv_device_get_register_feature_value;
arv_device_dup_register_feature_value_t arv_device_dup_register_feature_value;

arv_device_create_stream_t arv_device_create_stream;

Expand Down Expand Up @@ -969,14 +965,9 @@ class U3VRealCam: public U3V{
// Check each parameters for GenDC device ==========================
if (is_gendc_){
log::info("\tDevice/USB {}::{} : {}", i, "GenDC", "Available");
uint64_t gendc_desc_size = arv_device_get_register_feature_length(devices_[i].device_, "GenDCDescriptor", &err_);
if (err_) {
throw std::runtime_error(err_->message);
}
uint64_t gendc_desc_size = 0;
char* buffer = reinterpret_cast<char *>(arv_device_dup_register_feature_value(devices_[i].device_,"GenDCDescriptor", &gendc_desc_size, &err_ ));

char* buffer;
buffer = (char*) malloc(gendc_desc_size);
arv_device_get_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_);
if (err_) {
throw std::runtime_error(err_->message);
}
Expand Down Expand Up @@ -1453,17 +1444,12 @@ class U3VGenDC: public U3V{
// Check each parameters for GenDC device ==========================
if (is_gendc_){
log::info("\tDevice/USB {}::{} : {}", i, "GenDC", "Available");
uint64_t gendc_desc_size = arv_device_get_register_feature_length(devices_[i].device_, "GenDCDescriptor", &err_);
uint64_t gendc_desc_size = 0;
char* buffer = reinterpret_cast<char *>(arv_device_dup_register_feature_value(devices_[i].device_,"GenDCDescriptor", &gendc_desc_size, &err_ ));
if (err_) {
throw std::runtime_error(err_->message);
}

char* buffer;
buffer = (char*) malloc(gendc_desc_size);
arv_device_get_register_feature_value(devices_[i].device_, "GenDCDescriptor", gendc_desc_size, (void*)buffer, &err_);
if (err_) {
throw std::runtime_error(err_->message);
}
if(isGenDC(buffer)){
gendc_descriptor_= ContainerHeader(buffer);
std::tuple<int32_t, int32_t> data_comp_and_part = gendc_descriptor_.getFirstAvailableDataOffset(true);
Expand Down
Loading