Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Unhandled Exception when using cv::resize(....) with 5 threads simultaneously

Using visual c++ (15.7.5 - 2017).

When using this line (by 5 threads) :

cv::resize(img_export_5, resized_img_export_5_ext, size, 0, 0, INTER_CUBIC);

I get this error frequently:

Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception. at cv.resize(_InputArray* , _OutputArray* , Size_<int>* , Double , Double , Int32 ) at UFO.UFO_microscopy.Thread_export_5.ThreadEntryPoint() in c:\users\ufo\desktop\f7 cimg updated\ufo\ufo\ufo_microscopy.h:line 2402 at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

Note: When I use 4 threads, I get this error less frequently.

Please help me!!!!Please help me!!!Please help me!!!!

click to hide/show revision 2
None

updated 2018-10-15 03:54:28 -0600

berak gravatar image

Unhandled Exception when using cv::resize(....) with 5 threads simultaneously

Using visual c++ (15.7.5 - 2017).

When using this line (by 5 threads) :

cv::resize(img_export_5, resized_img_export_5_ext, size, 0, 0, INTER_CUBIC);

INTER_CUBIC);

I get this error frequently:

Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at cv.resize(_InputArray* , _OutputArray* , Size_<int>* , Double , Double , Int32 )
   at UFO.UFO_microscopy.Thread_export_5.ThreadEntryPoint() in c:\users\ufo\desktop\f7 cimg updated\ufo\ufo\ufo_microscopy.h:line 2402
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

System.Threading.ThreadHelper.ThreadStart()

Note: When I use 4 threads, I get this error less frequently.

Please help me!!!!Please help me!!!Please help me!!!!

Unhandled Exception when using cv::resize(....) with 5 threads simultaneously

Using visual c++ (15.7.5 - 2017).

When using this line (by 5 threads) :

cv::resize(img_export_5, resized_img_export_5_ext, size, 0, 0, INTER_CUBIC);

INTER_CUBIC);

I get this error frequently:

Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception. at cv.resize(_InputArray* , _OutputArray* , Size_<int>* , Double , Double , Int32 ) at UFO.UFO_microscopy.Thread_export_5.ThreadEntryPoint() in c:\users\ufo\desktop\f7 cimg updated\ufo\ufo\ufo_microscopy.h:line 2402 at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() System.Threading.ThreadHelper.ThreadStart()

Here is the block where I get the error:

Mat img_export_1(4000, 8800, CV_8U, Scalar(0));

Mat resized_img_export_1_ext;

while (export_thread_1_cont) {cv::Size size(calibrated_x_length_external, y_length_read_bin_file); cv::Size size_final(0, 0);

while (!export_frame_available_1)
{
    if (!export_thread_1_cont)  break;
    // WAITS FOR FRAME
}
if (!export_thread_1_cont)  break;

for (int width = 0; width < y_length_read_bin_file; width++)
{
    for (int length = 0; length < samplesPerRecord_read_bin_file; length = length + 1)
    {
        avg = loaded_image_array_1[width][length];

        mapped_value = ((avg - lower_limit[selected_channel_num]) / (contrast_calibration_ext[length] - lower_limit[selected_channel_num])) * 255;

        img_export_1.at<uchar>(width, length) = mapped_value;
    }
}

resize(img_export_1, resized_img_export_1_ext, size, 0, 0, INTER_CUBIC);

sprintf(export_file_name, "%s\\%d.bmp", export_directory_full, selected_frame_export_1);
imwrite(export_file_name, resized_img_export_1_ext);

export_frame_available_1 = false;
goto back_exp_1;

}

Note: When I use 4 threads, I get this error less frequently.

Please help me!!!!Please help me!!!Please help me!!!!

click to hide/show revision 4
None

updated 2018-10-15 04:44:12 -0600

berak gravatar image

Unhandled Exception when using cv::resize(....) with 5 threads simultaneously

Using visual c++ (15.7.5 - 2017).

When using this line (by 5 threads) :

cv::resize(img_export_5, resized_img_export_5_ext, size, 0, 0, INTER_CUBIC);

I get this error frequently:

Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception. at cv.resize(_InputArray* , _OutputArray* , Size_<int>* , Double , Double , Int32 ) at UFO.UFO_microscopy.Thread_export_5.ThreadEntryPoint() in c:\users\ufo\desktop\f7 cimg updated\ufo\ufo\ufo_microscopy.h:line 2402 at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

Here is the block where I get the error:

Mat img_export_1(4000, 8800, CV_8U, Scalar(0));

Scalar(0)); Mat resized_img_export_1_ext;

resized_img_export_1_ext; while (export_thread_1_cont) {cv::Size size(calibrated_x_length_external, y_length_read_bin_file); cv::Size size_final(0, 0);

0);

    while (!export_frame_available_1)
 {
     if (!export_thread_1_cont)  break;
     // WAITS FOR FRAME
 }
 if (!export_thread_1_cont)  break;

 for (int width = 0; width < y_length_read_bin_file; width++)
 {
     for (int length = 0; length < samplesPerRecord_read_bin_file; length = length + 1)
     {
         avg = loaded_image_array_1[width][length];

         mapped_value = ((avg - lower_limit[selected_channel_num]) / (contrast_calibration_ext[length] - lower_limit[selected_channel_num])) * 255;

         img_export_1.at<uchar>(width, length) = mapped_value;
     }
 }

 resize(img_export_1, resized_img_export_1_ext, size, 0, 0, INTER_CUBIC);

 sprintf(export_file_name, "%s\\%d.bmp", export_directory_full, selected_frame_export_1);
 imwrite(export_file_name, resized_img_export_1_ext);

 export_frame_available_1 = false;
 goto back_exp_1;
}

}

Note: When I use 4 threads, I get this error less frequently.

Please help me!!!!Please help me!!!Please help me!!!!