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

Viewer/accept zero exposuretime #821

Conversation

Fixstars-momoko
Copy link
Contributor

Current arv-viewer accepts >= 1.0 ExposureTime, while GenICam defines its value is >= 0.

This disables the slider when the minimum of ExposureTime is less than 0, so I shifted the value +1.0 so that it makes log10(min) more than or equal to 0.

Reference: https://www.emva.org/wp-content/uploads/GenICam_SFNC_v2_7.pdf

@EmmanuelP
Copy link
Contributor

It would be clearer and simpler to clamp the minimum exposure value returned by arv_camera_get_exposure_time_bounds here:

arv_camera_get_exposure_time_bounds (viewer->camera, &viewer->exposure_min, &viewer->exposure_max, NULL);

@EmmanuelP EmmanuelP marked this pull request as draft September 20, 2023 06:10
@EmmanuelP
Copy link
Contributor

EmmanuelP commented Sep 20, 2023

It would event better to get back to a linear progression if minimum exposure time is <= 0

@EmmanuelP
Copy link
Contributor

As a bonus, you may also use the Representation property of ExposureTime.

It is explained page 33 of the Genicam specification: https://www.emva.org/wp-content/uploads/GenICam_Standard_v2_1_1.pdf

@Fixstars-momoko
Copy link
Contributor Author

@EmmanuelP Hi, thanks for the feedback and the info of Representation #821 (comment)

I have updated gtk widget as follows:

Representation Linear Logarithmic PureNumber Undefined default /other
edit box enabled enabled enabled enabled disabled
slider enabled enabled disabled enabled disabled
slider-scale min-max 0-1 N/A min-max N/A

I was not sure in the case of Undefined (-1), so I tentatively enabled both widgets. Please let me know if they are supposed to be disabled.

@Fixstars-momoko Fixstars-momoko marked this pull request as ready for review October 31, 2023 22:22
Copy link
Contributor

@EmmanuelP EmmanuelP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request. The comments are mainly coding style issues. Please fix them an I'll merge the changes.

src/arvcamera.c Outdated
*/

ArvGcRepresentation
arv_camera_get_representation_gain (ArvCamera *camera, GError **error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this function to arv_camera_get_gain_representation()
Remove the error placeholder. Errors are for communication problems, not programming errors. get_representation comes directly from the xml data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in b9c1305

src/arvcamera.c Outdated
*/

ArvGcRepresentation
arv_camera_get_representation_exposure_time (ArvCamera *camera, GError **error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this function to arv_camera_get_exposure_time_representation()
Remove the error placeholder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in b9c1305

src/arvcamera.c Outdated
{
ArvCameraPrivate *priv = arv_camera_get_instance_private (camera);

g_return_val_if_fail (ARV_IS_CAMERA (camera), FALSE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type mismatch, return REPRESENTATION_UNDEFINED instead, and update the doc accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 17a2454

src/arvcamera.c Outdated
{
ArvCameraPrivate *priv = arv_camera_get_instance_private (camera);

g_return_val_if_fail (ARV_IS_CAMERA (camera), FALSE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type mismatch, return REPRESENTATION_UNDEFINED instead, and update the doc accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 17a2454

* Since:
*/

ArvGcRepresentation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the error placeholder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in b9c1305

Comment on lines 760 to 761
// gtk_range_set_range (GTK_RANGE (viewer->exposure_hscale), 0.0, 1.0);
// gtk_range_set_range (GTK_RANGE (viewer->gain_hscale), viewer->gain_min, viewer->gain_max);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't leave commented code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in 1fd760c

Comment on lines 148 to 149
gint gain_representation;
gint exposure_time_representation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong type, use ArvGcRepresentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in c5ccba1

gtk_widget_set_sensitive (viewer->gain_hscale, is_gain_available);
gtk_widget_set_sensitive (viewer->gain_spin_button, is_gain_available);
if (is_gain_available){
viewer->gain_representation = (gint)(arv_camera_get_representation_gain(viewer->camera, NULL));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the cast to gint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in c5ccba1

gtk_widget_set_sensitive (viewer->exposure_hscale, is_exposure_available);
gtk_widget_set_sensitive (viewer->exposure_spin_button, is_exposure_available);
if (is_exposure_available){
viewer->exposure_time_representation = (gint)(arv_camera_get_representation_exposure_time(viewer->camera, NULL));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the cast to gint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in c5ccba1

@@ -749,17 +767,66 @@ set_camera_widgets(ArvViewer *viewer)
string = g_strdup_printf ("%g", arv_camera_get_frame_rate (viewer->camera, NULL));
gtk_entry_set_text (GTK_ENTRY (viewer->frame_rate_entry), string);

// enables gtk widget based on feature representation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the comment, the code is self explanatory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in 1fd760c

@EmmanuelP
Copy link
Contributor

Thanks a lot. I have merged your changes with some minor fixes.

I may revert the widget selection based on representation though, at least for exposure time, as it looks like most of the time it is defined as linear, while logarithmic makes more sense.

@EmmanuelP EmmanuelP closed this Nov 2, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants