Giter Site home page Giter Site logo

Contrast about gst-pylonsrc HOT 21 CLOSED

zingmars avatar zingmars commented on July 28, 2024
Contrast

from gst-pylonsrc.

Comments (21)

zingmars avatar zingmars commented on July 28, 2024 1

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).

from gst-pylonsrc.

MattsProjects avatar MattsProjects commented on July 28, 2024 1

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

from gst-pylonsrc.

zingmars avatar zingmars commented on July 28, 2024

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.

from gst-pylonsrc.

chiuwe avatar chiuwe commented on July 28, 2024

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

from gst-pylonsrc.

zingmars avatar zingmars commented on July 28, 2024

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.

from gst-pylonsrc.

chiuwe avatar chiuwe commented on July 28, 2024

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++?

from gst-pylonsrc.

zingmars avatar zingmars commented on July 28, 2024

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

from gst-pylonsrc.

chiuwe avatar chiuwe commented on July 28, 2024

Just to make sure i'm on the same page, are you looking at docs in .../pylon5/share/doc/BPD/?

from gst-pylonsrc.

zingmars avatar zingmars commented on July 28, 2024

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.

from gst-pylonsrc.

chiuwe avatar chiuwe commented on July 28, 2024

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.

from gst-pylonsrc.

zingmars avatar zingmars commented on July 28, 2024

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?

from gst-pylonsrc.

chiuwe avatar chiuwe commented on July 28, 2024

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.

from gst-pylonsrc.

zingmars avatar zingmars commented on July 28, 2024

What does PylonDeviceFeatureIsWritable(pylonsrc->deviceHandle, "BslContrast") return?

from gst-pylonsrc.

chiuwe avatar chiuwe commented on July 28, 2024

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.

from gst-pylonsrc.

zingmars avatar zingmars commented on July 28, 2024

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 :(

from gst-pylonsrc.

chiuwe avatar chiuwe commented on July 28, 2024

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.

from gst-pylonsrc.

zingmars avatar zingmars commented on July 28, 2024

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).

from gst-pylonsrc.

chiuwe avatar chiuwe commented on July 28, 2024

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

from gst-pylonsrc.

zingmars avatar zingmars commented on July 28, 2024

from gst-pylonsrc.

MattsProjects avatar MattsProjects commented on July 28, 2024

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.
Screenshot from 2020-02-14 11-44-24
Screenshot from 2020-02-14 11-44-48
Screenshot from 2020-02-14 11-45-03
Screenshot from 2020-02-14 11-45-17
gstpylonsrc_edit.zip

from gst-pylonsrc.

chiuwe avatar chiuwe commented on July 28, 2024

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

from gst-pylonsrc.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.