-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Fake camera with a mock video pattern don't get picked up by arvtools/arviewer. #955
Comments
Hi, The XML data you have attached is really what you are giving to the fake camera ? It is highly incomplete. |
Do you have an example on how to properly write this document? Since I have limited knowledge of aravis/gigevision I would love to have any kind of info on how to properly populate the xml document. |
I also tried a simpler method without an xml and a custom fill pattern but it does not work : #include <arv.h>
#include <csignal>
#include <iostream>
static GMainLoop *g_main_loop = nullptr;
// Callback matching ArvFakeCameraFillPattern signature.
// Parameters:
// - buffer: The image buffer to fill.
// - user_data: A user pointer (unused in this example).
// - width, height: Dimensions of the image.
// - payload: The expected size of the image buffer in bytes.
void fill_pattern_callback(ArvBuffer *buffer, void *user_data,
unsigned int width, unsigned int height,
unsigned int payload) {
size_t size;
// Obtain a writable pointer to the buffer data (casting away const is safe
// here).
uint8_t *pixels = const_cast<uint8_t *>(
static_cast<const uint8_t *>(arv_buffer_get_data(buffer, &size)));
if (!pixels)
return;
// Fill with a simple gradient pattern.
for (unsigned int y = 0; y < height; ++y) {
for (unsigned int x = 0; x < width; ++x) {
pixels[y * width + x] = static_cast<uint8_t>((x + y) & 0xFF);
}
}
}
static void signal_handler(int signum) {
if (g_main_loop)
g_main_loop_quit(g_main_loop);
}
int main(int argc, char **argv) {
// g_type_init() is deprecated in GLib 2.36 and later, so only call it if
// needed.
#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif
// Create a fake GigE Vision camera. Passing nullptr uses the loopback
// interface.
ArvGvFakeCamera *gv_cam = arv_gv_fake_camera_new(nullptr, "SIMCAM01");
if (!gv_cam) {
std::cerr << "Failed to create fake camera\n";
return -1;
}
// Get the underlying fake camera object.
ArvFakeCamera *fake_cam = arv_gv_fake_camera_get_fake_camera(gv_cam);
// Set our custom fill pattern callback.
arv_fake_camera_set_fill_pattern(fake_cam, fill_pattern_callback, nullptr);
// Set the frame rate to 30 FPS.
arv_fake_camera_set_trigger_frequency(fake_cam, 30.0);
std::cout << "Fake camera streaming on loopback (serial: SIMCAM01)\n";
std::cout << "Press Ctrl+C to exit." << std::endl;
std::signal(SIGINT, signal_handler);
// Start the GLib main loop to keep the fake camera running.
g_main_loop = g_main_loop_new(nullptr, FALSE);
g_main_loop_run(g_main_loop);
// Cleanup.
g_object_unref(gv_cam);
g_main_loop_unref(g_main_loop);
return 0;
} When I try to read it using aravissrc I get : gst-launch-1.0 aravissrc camera-name=SIMCAM01 ! videoconvert ! autovideosink
Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstAravis:aravis0: Could not find camera "SIMCAM01": Device 'SIMCAM01' not found
Additional debug info:
../gst/gstaravis.c(457): gst_aravis_init_error (): /GstPipeline:pipeline0/GstAravis:aravis0
ERROR: pipeline doesn't want to preroll.
ERROR: from element /GstPipeline:pipeline0/GstAravis:aravis0: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3556): gst_base_src_start (): /GstPipeline:pipeline0/GstAravis:aravis0:
Failed to start
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ... but using arv camera it seems it is recognizable : ./arv-camera-test-0.8
Looking for the first available camera
vendor name = Aravis
model name = Fake
device serial number = SIMCAM01
image width = 512
image height = 512
horizontal binning = 1
vertical binning = 1
exposure = 10000 µs
gain = 0 dB
payload = 262144 bytes
gv n_stream channels = 1
gv current channel = 0
gv packet delay = 0 ns
gv packet size = 1400 bytes
6 frames/s - 1.57 MiB/s
5 frames/s - 1.31 MiB/s
^C 5 frames/s - 1.31 MiB/s
n_completed_buffers = 16
n_failures = 0
n_underruns = 0
n_timeouts = 0
n_aborted = 0
n_missing_frames = 0
n_size_mismatch_errors = 0
n_received_packets = 3120
n_missing_packets = 0
n_error_packets = 0
n_ignored_packets = 0
n_resend_requests = 0
n_resent_packets = 0
n_resend_ratio_reached = 0
n_resend_disabled = 0
n_duplicated_packets = 0
n_transferred_bytes = 4219968
n_ignored_bytes = 0
|
Using arv-tool-0.8 I got : Aravis-Fake-GV01 (127.0.0.1)
Aravis-Fake-SIMCAM01 (127.0.0.1) But when reading them : gst-launch-1.0 -v aravissrc camera-name=Fake_1 ! videoconvert ! autovideosink
Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstAravis:aravis0: Could not find camera "Fake_1": Device 'Fake_1' not found
Additional debug info:
../gst/gstaravis.c(457): gst_aravis_init_error (): /GstPipeline:pipeline0/GstAravis:aravis0
ERROR: pipeline doesn't want to preroll.
ERROR: from element /GstPipeline:pipeline0/GstAravis:aravis0: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failu
re.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3556): gst_base_src_start (): /GstPipeline:pipeline0/GstAravis:aravis0:
Failed to start
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...
// OR
gst-launch-1.0 -v aravissrc camera-name=Aravis-Fake-SIMCAM01 ! videoconvert ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstAravis:aravis0: stream = (null)
/GstPipeline:pipeline0/GstAravis:aravis0.GstPad:src: caps = video/x-raw, format=(string)GRAY8, width=(int)512, height=(int)512, framerate=(fraction)5/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, width=(int)512, height=(int)512, framerate=(fraction)5/1, format=(string)YUY2
/GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-raw, width=(int)512, height=(int)512, framerate=(fraction)5/1, format=(st
ring)YUY2
/GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXvImageSink:autovideosink0-actual-sink-xvimage.GstPad:sink: caps = video/x-raw, width=(int)512, height=(int)512, framerate=(f
raction)5/1, format=(string)YUY2
/GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0.GstGhostPad:sink: caps = video/x-raw, width=(int)512, height=(int)512, framerate=(fraction)5/1, format=(string)YUY2
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)GRAY8, width=(int)512, height=(int)512, framerate=(fraction)5/1
Redistribute latency...
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:05.321237118
Setting pipeline to NULL ...
Freeing pipeline ... I just get black screen. |
Describe the bug
I'm trying to build a fake camera source with my own specific pattern using opencv. However the camera starts but seems to never get picked up by the arvtools/arvviewer.
To Reproduce
Here's my code:
The xml context I used:
Expected behavior
The camera should appear in the arviewer or in the arvtools.
Platform description:
The text was updated successfully, but these errors were encountered: