shimat / opencvsharp

OpenCV wrapper for .NET
Apache License 2.0
5.22k stars 1.13k forks source link

Hi I have a problem Exception Info: System.AccessViolationException at OpenCvSharp.Internal.NativeMethods.core_Mat_copyTo_toMat1(IntPtr, IntPtr) #1643

Open dedeemre00 opened 5 months ago

dedeemre00 commented 5 months ago

Summary of your issue

Environment

Write your environment.

What did you do when you faced the problem?

Write here

Example code:

        private void ustKameraVeri()
        {

            if (plcBaglanti)
            {
                try
                {

                    int parcaNo = siemens.UstKameraParcaNo;
                    mUst[parcaNo] = new Mat();
                    try
                    {
                        kameraUst.foto.CopyTo(mUst[parcaNo]);

                    }
                    catch (Exception ex)
                    {
                        LogMessage($" üst kamera foto kopyalama{ex.Message}- {ex.StackTrace}");
                        olculemeyensayı++;
                        return;
                    }
                    sayac =siemens.toplamParca;

                    Thread thread = new Thread(() => otomatikOlcum(parcaNo));
                    thread.Start();

                    if (mUst[parcaNo] != null & mAlt[parcaNo] != null & mYan[parcaNo] != null)
                    {
                        if (!mUst[parcaNo].Empty() & !mAlt[parcaNo].Empty() & !mYan[parcaNo].Empty())
                        {
                            matUst = mUst[parcaNo];
                            matAlt = mAlt[parcaNo];
                            matYan = mYan[parcaNo];
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogMessage($"Üst Kamera veri alınamadı: {ex.Message}");

                }

            }

        }

Output:

paste your output

What did you intend to be?