Skip to content

Commit

Permalink
unbreak ROI selection (#474)
Browse files Browse the repository at this point in the history
* unbreak ROI selection

New exposure mode did not correctly set the capture ROI if the image size
was manually specified. It was calling SetROI with a 0x0 window which would
cause subsequent captures to fail.

* exit if ROI set fails

Not exiting with a high error code since it might be a transitory error,
or something the user can fix quickly based on the log message.
  • Loading branch information
ckuethe authored Sep 14, 2021
1 parent d7fa25f commit ca6b4aa
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1537,9 +1537,11 @@ const char *locale = DEFAULT_LOCALE;

if (width == 0 || height == 0)
{
width = iMaxWidth; originalWidth = width;
height = iMaxHeight; originalHeight = height;
width = iMaxWidth;
height = iMaxHeight;
}
originalWidth = width;
originalHeight = height;

ASIGetControlValue(CamNum, ASI_TEMPERATURE, &actualTemp, &bAuto);
printf("- Sensor temperature:%0.2f\n", (float)actualTemp / 10.0);
Expand Down Expand Up @@ -1931,7 +1933,12 @@ const char *locale = DEFAULT_LOCALE;
pRgb.create(cvSize(width, height), CV_8UC1);
}

ASISetROIFormat(CamNum, width, height, currentBin, (ASI_IMG_TYPE)Image_type);
asiRetCode = ASISetROIFormat(CamNum, width, height, currentBin, (ASI_IMG_TYPE)Image_type);
if (asiRetCode)
{
printf("ASISetROIFormat(%d, %dx%d, %d, %d) = %s\n", CamNum, width, height, currentBin, Image_type, getRetCode(asiRetCode));
closeUp(1);
}
setControl(CamNum, ASI_BRIGHTNESS, currentBrightness, ASI_FALSE); // ASI_BRIGHTNESS == ASI_OFFSET

// Here and below, indent sub-messages with " > " so it's clear they go with the un-indented line.
Expand Down

0 comments on commit ca6b4aa

Please sign in to comment.