Closed chiuwe closed 4 years ago
As far as I can tell Pylon 5.0.12 does not let you set contrast values, and as such this plugin does not have this functionality.
Just curious, where do you check if pylon supports certain functions or not? From this page it looks like basler does support certain functions. I dont know how this relates to pylon though. https://docs.baslerweb.com/brightness-and-contrast.html
The pylon redist comes with header files and docs that describe all available functions. If it's not there, it's usually a sign that it's not available.
The docs you linked seem to be from Pylon 6.0, but as far as I can tell it's only available for Windows right now.
I do agree with you that contrast doesnt exist for Pylon 5.0.12 in C. But the docs do show contrast settings in C++. Is there a reason why we can't use C++?
gstreamer plugins are written in C using gobject etc libs. It might be possible, but I suspect gobject won't play well with C++, if at all.
I don't know if they're suitable for your use case, but AppSrc plugins can be written in C++, and there's one for pylon available here https://github.com/MattsProjects/pylon_gstreamer
Ah, looking at the docs again, I guess I missed the struct entries the first time because the doc search they have is broken (had to grep for them).
Yeah, you should be able to add it by just adding the instructions to set BslContrast, i.e. PylonDeviceSetFloatFeature(pylonsrc->deviceHandle, "BslContrast", <value>);
.
for BslContrastMode, you'll need PylonDeviceFeatureFromString(pylonsrc->deviceHandle, "BslContrastMode", <value>);
, where value can be either Linear
or SCurve
.
You'll need to check for the features first using PylonDeviceFeatureIsAvailable
. From what I gather these will only work with dart and pulse cameras (not ace).
Just to make sure i'm on the same page, are you looking at docs in .../pylon5/share/doc/BPD/
?
I use the C++ docs to look at the classes, i.e. C++/class_basler___usb_camera_params_1_1_c_usb_camera_params___params.html#a330bd845cac1b1631066736d857220f3
. When developing this I basically took everything pylon gave me for my camera (it was an ace), and just implemented it into the plugin (which is why contrast controls are missing). The BPD docs had a bunch of stuff I didn't need, so I didn't use them.
how do i go about troubleshooting the camera? I'm using a dart and i implemented the contrast. The camera doesnt seem to be throwing any error, but contrast also isnt changing as expected.
Does it change at all? Does it change properly using the Pylon viewer app? How different are the results you get from the viewer app and gstreamer video output?
it doesnt change at all, when pull the parameter GST_DEBUG_OBJECT(pylonsrc, "The resulting contrast is %.0lf.", contrastRate);
after i set it, it still returns 0.
if(PylonDeviceFeatureIsAvailable(pylonsrc->deviceHandle, "BslContrast")) {
GST_DEBUG_OBJECT(pylonsrc, "Setting contrast to %.2lf", pylonsrc->contrast);
res = PylonDeviceFeatureFromString(pylonsrc->deviceHandle, "BslContrastMode", "Linear");
PYLONC_CHECK_ERROR(pylonsrc, res);
res = PylonDeviceSetFloatFeature(pylonsrc->deviceHandle, "BslContrast", pylonsrc->contrast);
PYLONC_CHECK_ERROR(pylonsrc, res);
double contrastRate = 0.0;
res = PylonDeviceGetFloatFeature(pylonsrc->deviceHandle, "BslContrast", &contrastRate);
PYLONC_CHECK_ERROR(pylonsrc, res);
GST_DEBUG_OBJECT(pylonsrc, "The resulting contrast is %.0lf.", contrastRate);
} else {
GST_WARNING_OBJECT(pylonsrc, "This camera doesn't support contrast.");
}
when i adjust contrast in the viewer it does change the output 0->.22 results in a brighter image. In gstreamer video output it looks the same as 0.
What does PylonDeviceFeatureIsWritable(pylonsrc->deviceHandle, "BslContrast")
return?
it returns true.
0:00:01.177648058 35322 0x5617454b4630 DEBUG pylonsrc gstpylonsrc.c:1067:gst_pylonsrc_start:<pylonsrc0> Is contrast writeable: 1.
0:00:01.177689018 35322 0x5617454b4630 DEBUG pylonsrc gstpylonsrc.c:1068:gst_pylonsrc_start:<pylonsrc0> Setting contrast to 0.22
0:00:01.222329427 35322 0x5617454b4630 DEBUG pylonsrc gstpylonsrc.c:1079:gst_pylonsrc_start:<pylonsrc0> The resulting contrast is 0.
Hm, this is really weird. I've never seen a situation where it fails to set a value without an error message like this. And without a camera there's very little I can do myself to test it. Sorry I couldn't be of more help :(
so i'm also trying adjust saturation. The doc says that saturation is only available for YCbCr422-8 or RGB8 format. I'm using YCbCr422-8 but when i check to see if saturation is available it returns false.
I can see in the pylon viewer changing the image format will gray out/not gray out saturation.
I'm wondering if the image format isn't set yet when i trying to change saturation?
i adjust saturation after your plugin prints out pylonsrc gstpylonsrc.c:1255:gst_pylonsrc_start:<pylonsrc0> Using YCbCr422_8 image format.
Does it happen if you set the correct format in pylon viewer, then stop it from streaming without disconnecting the device (close the viewer) and run the plugin? All active settings are saved in camera's RAM (at least ace's were), so if you set something up in the viewer the settings should carry on to the output of the plugin as well (as long as the plugin doesn't overwrite them, which it does for some settings).
I can't run gstreamer plugin while device is still connected to pylon viewer. It looks like the default pixel format is YCbCr422-8, so i dont understand why i can't set saturation. It looks like like none of the settings is saved in RAM for this camera. I'm trying to get in touch with basler, maybe they can help me debug their own hardware
The viewer should have an option to stop streaming (disconnect) that should let you use the camera using gstreamer. Let's hope Basler can sort this.
On Wed, 12 Feb 2020, 23:23 Steven Chiu, notifications@github.com wrote:
I can't run gstreamer plugin while device is still connected to pylon viewer. It looks like the default pixel format is YCbCr422-8, so i dont understand why i can't set saturation. It looks like like none of the settings is saved in RAM for this camera. I'm trying to get in touch with basler, maybe they can help me debug their own hardware
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zingmars/gst-pylonsrc/issues/16?email_source=notifications&email_token=AAG75BVTG3BQ6COTWQ24E63RCRSD5A5CNFSM4KSUBTLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELSN2VI#issuecomment-585424213, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG75BT23YQTPI7UE5S7LOLRCRSD5ANCNFSM4KSUBTLA .
Hi there, For the contrast issue, I think that maybe you are not completely implementing this into the code? I attached the .h and .c that I just edited over here and a screenshot. It seems to work fine for me... For the saturation issue, maybe check the order of operations here. The pixel format must be set first before the saturation becomes available. So when I set "imageformat=YCbCr422_8 colorredsaturation=1.2", that worked. gstpylonsrc_edit.zip
Hi Matt,
Thank you for helping me out.
I looked at your code for contrast and it looks identical to mine.
I found a bug with mine though.
GST_DEBUG_OBJECT(pylonsrc, "The resulting contrast is %.0lf.", contrastRate);
which is why it would return 0 when i try to set it to .22.
But I still can't get saturation to work. my dart camera doesnt support saturation via color adjustment (COLORREDSATURATION, COLORYELLOWSATURATION, etc) The doc says I should be using 'BslSaturation'. but it returns false when i queue it with PylonDeviceFeatureIsAvailable(). I believe that the pixelFormat is already set before i try to set saturation. Ive included my code for you to review. gstpylonsrc-mod.zip
Hi Steven, Try "BslSaturationValue" instead. I think our documentation here has a typo (perhaps the section is a bit outdated). :-(. If possible, try to use the pylon viewer as the first go to for feature names. It is pulling the xml file directly from the camera. Sorry for this! -Matt
How do i adjust contrast? Do i need to add it myself?