Tag: emgucv

如何使用EMGU计算DFT及其反转?

如何计算图像的DFT(使用EMGU),显示它然后计算反转以恢复原始图像? 我将在这里回答我自己的问题,因为我花了一段时间才弄明白。

使用EMGUcv进行颜色跟踪

我正在尝试制作一个彩色对象跟踪器,它使用二进制图像和斑点检测器来跟踪目标类型: https : //www.youtube.com/watch?v = 9qky6g8NRmI 。 但是我无法弄清楚ThresholdBinary()方法是如何工作的,以及它是否是正确的。 以下是代码的相关部分: cam._SmoothGaussian(3); blobDetector.Update(cam); Image binaryImage = cam.ThresholdBinary(new Bgr(145,0,145),new Bgr(0,0,0)); Image binaryImageGray = binaryImage.Conver(); blobTracker.Process(cam, binaryImageGray); foreach (MCvBlob blob in blobTracker) { cam.Draw((Rectangle)blob, new Bgr(0,0,255),2); } 当我显示binaryImage时,我甚至没有得到blob。 我只是得到一个黑色的图像。

如何将mat转换为图像

我需要将Mat转换为Emgu CV中的Image。 尝试将Mat转换为图像会产生exception: Cannot implicitly convert type ‘Emgu.CV.Mat’ to ‘Emgu.CV.Image Image imgeOrigenal; Capture capWebcam = null; imgeOrigenal = capWebcam.QueryFrame();//error line 如何将Mat转换为图像?

使用emgu.cv的Alpha合成图像

Emgu.CV(Nuget包2.4.2)并没有我能告诉实现OpenCV中可用的gpu :: alphaComp方法。 因此,当尝试实现这种特定类型的复合时,C#中的速度令人难以置信,这样它占用了我应用程序总CPU容量的80%。 这是我原来的解决方案,表现非常糟糕。 static public Image Overlay( Image image1, Image image2 ) { Image result = image1.Copy(); Image src = image2; Image dst = image1; int rows = result.Rows; int cols = result.Cols; for (int y = 0; y < rows; ++y) { for (int x = 0; x < cols; ++x) { […]

在emgu cv中找到otsu阈值的function是什么?

我不需要阈值图像。 我想要门槛。 我在OpenCV中发现了这个。 cv::threshold( orig_img, thres_img, 0, 255, CV_THRESH_BINARY+CV_THRESH_OTSU ); 在EmguCv中是否存在等价物。 提前致谢。 PS。 我需要将此阈值用于canny边缘检测器

检测人们穿越OpenCV线

我想计算从两边越过一条线的人数。 我有一个放在天花板上的摄像机,用于拍摄线路所在的地板(因此摄像机只能看到人头顶部;所以它更像物体探测而不是人物探测)。 是否有针对此问题或类似问题的示例解决方案? 所以我可以向他们学习? 编辑1:任何时候都有不止一个人越线。

如何使用emgu cv在图像中找到任何旋转角度的黑色方块

我需要在测试表中找到三个黑色方块的坐标。 我从网站emgu.com上获取了示例代码并略微改变了它,但他找不到我需要的东西。 图像的大小为A4,测试forms的大小为A5。 我希望对你有所帮助:)我差点忘了,正方形的大小为30像素。 private void DetectRectangles(Image img) { var size = new Size(3, 3); CvInvoke.GaussianBlur(img, img, size, 0); CvInvoke.AdaptiveThreshold(img, img, 255, AdaptiveThresholdType.MeanC, ThresholdType.Binary, 75, 100); UMat cannyEdges = new UMat(); CvInvoke.Canny(img, cannyEdges, 180, 120); var boxList = new List(); using (VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint()) { CvInvoke.FindContours(cannyEdges, contours, null, RetrType.Tree, ChainApproxMethod.ChainApproxSimple); int count = […]

在C#中调整图像大小并将其发送到OpenCV会导致图像失真

这是与此相关的后续问题。 基本上,我有一个使用OpenCV进行图像处理的DLL。 有两种方法,一种接受image-Path ,另一种接受cv::Mat 。 使用image-path工作正常。 接受image那个是有问题的。 这是接受文件名(DLL)的方法: CDLL2_API void Classify(const char * img_path, char* out_result, int* length_of_out_result, int N) { auto classifier = reinterpret_cast(GetHandle()); cv::Mat img = cv::imread(img_path); cv::imshow(“img recieved from c#”, img); std::vector result = classifier->Classify(std::string(img_path), N); std::string str_info = “”; //… *length_of_out_result = ss.str().length(); } 这是接受图像(DLL)的方法: CDLL2_API void Classify_Image(unsigned char* img_pointer, unsigned […]

EmguCV仅在x86发布模式下出现内存不足 – 锐化图像

我试图使用EmguCV增加图像的清晰度 Image myImage = new Image(new Bitmap(pictureBox1.Image)); float[,] matrixKernel = new float[3, 3] { { 0,-1, 0 }, {-1, 5,-1 }, { 0,-1, 0 } }; ConvolutionKernelF matrix = new ConvolutionKernelF(matrixKernel); Image result = myImage.Convolution(matrix); Image BGRResult = result.ConvertScale(1, 0); e.Result = BGRResult.ToBitmap(); myImage.Dispose(); result.Dispose(); BGRResult.Dispose(); 该代码适用于中等分辨率图像,但在使用高分辨率图像时,例如:6000X4000抛出以下exception 请注意,当项目设置为AnyCPU时,即使对于高分辨率图像,锐化也能正常工作 – >调试模式我正在使用EmguCV 3.3 更新 : 根据Rick的参考答案,我做了以下修改,但问题仍然存在。请咨询。 float[,] […]

将“Emgu.CV.Mat”分配给`Emgu.CV.UI.ImageBox`(Emgu)时出现’System.AccessViolationException’

您正在尝试将Emgu.CV.Mat分配给Emgu.CV.Mat ,但我在CvInvokeCore.cs文件中遇到System.AccessViolationException错误(第2379行cveMinMaxLoc(iaArr, ref minVal, ref maxVal, ref minLoc, ref maxLoc, iaMask); ): Emgu.CV.World.dll中出现未处理的“System.AccessViolationException”类型exception 附加信息:尝试读取或写入受保护的内存。 这通常表明其他内存已损坏。 守则非常简单。 我生成一个位图 Bitmap tmp = mybitmap.getBitmap(); // generates my Bitmap pictureBox1.Image = tmp; // assigning it to an Win Form picture Box works pretty fine imageBox1.Image = ConvertBitmapToMat(tmp); // but converting the Bitmap to an Mat file // and try […]