简介: 外国不过十一,所以利用十一假期,看看他们都在干什么。一、小白问题 Contour Single blob with multiple object Hi to everyone.

Contour Single blob with multiple object

Hi to everyone.

I'm developing an object shape identification application and struck up with separating close objects using contour, Since close objects are identified as single contour. Is there way to separate the objects?

Things I have tried:1. I have tried Image segmentation with distance transform and Watershed algorithm - It works for few images only2. I have tried to separate the objects manual using the distance between two points as mentioned in - I struck up with choosing the points that will separate the object.

I have attached a sample contour for the reference.

image description

Please suggest any comments to separate the objects.

分析:这个问题其实在阈值处理之前就出现了,我们常见的想法是对图像进行预处理,比如HSV 分割,或者在阈值处理的时候想一些方法。


Optimizing split/merge for clahe

I am trying to squeeze the last ms from a tracking loop. One of the time consuminig parts is doing adaptive contrast enhancement (clahe), which is a necessary part. The results are great, but I am wondering whether I could avoid some copying/splitting/merge or apply other optimizations.

Basically I do the following in tight loop:

cv::cvtColor(rgb, hsv, cv::COLOR_BGR2HSV);
std::vector<cv::Mat> hsvChannels;
cv::split(hsv, hsvChannels);
m_clahe->apply(hsvChannels[2], hsvChannels[2]); /* m_clahe constructed outside loop */
cv::merge(hsvChannels, hsvOut);
cv::cvtColor(hsvOut, rgbOut, cv::COLOR_HSV2BGR);

On the test machine, the above snippet takes about 8ms (on 1Mpix images), The actual clahe part takes only 1-2 ms.

1 answer

You can save quite a bit. First, get rid of the vector. Then, outside the loop, create a Mat for the V channel only.

Then use extractChannel and insertChannel to access the channel you're using. It only accesses the one channel, instead of all three like split does.

The reason you put the Mat outside the loop is to avoid reallocating it every pass through the loop. Right now you're allocating and deallocating three Mats every pass.

test code:

#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace std;
using namespace cv;
int main(){
TickMeter tm;
Ptr<CLAHE> clahe = createCLAHE();
    vector <Mat> hsvChannels;
    Mat img, hsv1, hsv2, hsvChannels2, diff;
    img = imread("lena.jpg");
    cvtColor (img, hsv1, COLOR_BGR2HSV);
    cvtColor (img, hsv2, COLOR_BGR2HSV);
for (int i = 0; i < 1000; i++)
        split(hsv2, hsvChannels);
        clahe->apply(hsvChannels[2], hsvChannels[2]);
        merge(hsvChannels, hsv2);
    cout<< tm << endl;
for (int i = 0; i < 1000; i++
        extractChannel(hsv1, hsvChannels2, 2);
        clahe->apply(hsvChannels2, hsvChannels2);
        insertChannel(hsvChannels2, hsv1, 2);
    cout<< tm;
    absdiff(hsv1, hsv2, diff);
    imshow("diff", diff*255);

extractChannel(hsv1hsvChannels2, 2);


Compare two images and highlight the difference

Hi - First I'm a total n00b so please be kind. I'd like to create a target shooting app that allows me to us the camera on my android device to see where I hit the target from shot to shot. The device will be stationary with very little to no movement. My thinking is that I'd access the camera and zoom as needed on the target. Once ready I'd hit a button that would start taking pictures every x seconds. Each picture would be compared to the previous one to see if there was a change - the change being I hit the target. If a change was detected the two imaged would be saved, the device would stop taking picture, the image with the change would be displayed on the device and the spot of change would be highlighted. When I was ready for the next shot, I would hit a button on the device and the process would start over. If I was done shooting, there would be a button to stop.

Any help in getting this project off the ground would be greatly appreciated.

retag flag offensive

This will be a very basic algorithm just to evaluate your use case. It can be improved a lot.

(i) In your case, the first step is to identify whether there is a change or not between 2 frames. It can be identified by using a simple StandardDeviation measurement. Set a threshold for acceptable difference in deviation.

Mat prevFrame, currentFrame;

    //Getting a frame from the video capture device.
    cap >> currentFrame;

    if( )
         //Finding the standard deviations of current and previous frame.
         Scalar prevStdDev, currentStdDev;
         meanStdDev(prevFrame, Scalar(), prevStdDev);
         meanStdDev(currentFrame, Scalar(), currentStdDev);

          //Decision Making.
          if(abs(currentStdDev - prevStdDev) < ACCEPTED_DEVIATION)
               Save the images and break out of the loop.

    //To exit from the loop, if there is a keypress event.

    //For swapping the previous and current frame.
    swap(prevFrame, currentFrame);

(ii) The first step will only identify the change in frames. In order to locate the position where the change occured, find the difference between the two saved frames using AbsDiff. Using this difference image mask, find the contours and finally mark the region with a bounding rectangle.

Hope this answers your question.

flag offensive link



opencv OCRTesseract::create v3.05

I have the version of tesseract 3.05 and opencv3.2 installed and tested. But when I tried the end-to-end-recognition demo code, I discovered that tesseract was not found using OCRTesseract::create and checked the documentation to find that the interface is for v3.02. Is it possible to use it with Tesseract v3.05 ? How?

retag flag offensive

How to create OpenCV binary files from source with tesseract ( Windows )

image description

i tried to explain the steps


extract it in a dir like "E:/leptonica-1.74.4"

run cmake

where is the source code : E:/leptonica-1.74.4

where to build binaries : E:/leptonica-1.74.4/build

click Configure buttonselect compiler

see "Configuring done"click Generate button and see "Generating done"

image description

Open Visual Studio 2015 >> file >> open "E:\leptonica-1.74.4\build\ALL_BUILD.vcxproj"select release, build ALL BUILD

see "Build: 3 succeeded" and be sure E:\leptonica-master\build\src\Release\leptonica-1.74.4.lib and E:\leptonica-1.74.4\build\bin\Release\leptonica-1.74.4.dll have been createdimage description


extract it in a dir like "E:/tesseract-3.05.01"

create a directory E:\tesseract-3.05.01\Files\leptonica\include

copy *.h from E:\leptonica-master\src into E:\tesseract-3.05.01\Files\leptonica\includecopy *.h from E:\leptonica-master\build\src into E:\tesseract-3.05.01\Files\leptonica\include

run cmake

where is the source code : E:/tesseract-3.05.01

where to build binaries : E:/tesseract-3.05.01/build

click Configure buttonselect compiler

set Leptonica_DIR to E:/leptonica-1.74.4\buildclick Configure button againsee "Configuring done"click Generate button and see "Generating done"

Open Visual Studio 2015 >> file >> open "E:/tesseract-3.05.01\build\ALL_BUILD.vcxproj"build ALL_BUILD

be sure E:\tesseract-3.05.01\build\Release\tesseract305.lib and E:\tesseract-3.05.01\build\bin\Release\tesseract305.dll generated

Step 3.create directory E:\tesseract-3.05.01\include\tesseract

copy all *.h files from





to E:/tesseract-3.05.01/include\tesseract

in OpenCV cmake set Tesseract_INCLUDE_DIR : E:/tesseract-3.05.01/include

set tesseract_LIBRARY E:/tesseract-3.05.01/build/Release/tesseract305.lib

set Lept_LIBRARY E:/leptonica-master/build/src/Release/leptonica-1.74.4.lib

when you click Configure button you will see "Tesseract: YES" it means everything is OK

make other settings and generate. Compile ....

flag offensive link


Pyramid Blending with Single input and Non-Vertical Boundar

Hi All,

Here is the input image.image description

Say you do not have the other half of the images. Is it still possible to do with Laplacian pyramid blending?

I tried stuffing the image directly into the algorithm. I put weights as opposite triangles. The result comes out the same as the input.My another guess is splitting the triangles. Do gaussian and Laplacian pyramid on each separately, and then merge them.

But the challenge is how do we apply Laplacian matrix on triangular data. What do we fill on the missing half? I tried 0. It made the boundary very bright.

If pyramid blending is not the best approach for this. What other methods do you recommend me to look into for blending?

Any help is much appreciated!

retag flag offensive


the answer is YES.what you need is pyrdown the images and lineblend them at each pyramid

jsxyhelu gravatar image jsxyhelu  (26 hours ago) edit

Thank you for your comment. I tried doing that (explained by my 2nd paragraph). The output is the same as the original image. Please note where I want to merge is NOT vertical. So I do not get what you meant by "line blend".

这个问题需要实现的是mulitband blend,而且实现的是倾斜过来的融合,应该说很奇怪,不知道在什么环境下会有这样的需求,但是如果作为算法问题来说的话,还是很有价值的。首先需要解决的是倾斜的line bend,值得思考。


DroidCam with OpenCV

With my previous laptop (Windows7) I was connecting to my phone camera via DroidCam and using videoCapture in OpenCV with Visual Studio, and there was no problem. But now I have a laptop with Windows 10, and when I connect the same way it shows orange screen all the time. Actually DroidCam app in my laptop works fine, it shows the video. However while using OpenCV videoCapture from Visual Studio it shows orange screen.

Thanks in advance

retag flag offensive
Disable laptop webcam from device manager and then restart. Then it works


OpenCV / C++ - Filling holes

Hello there,

For a personnel projet, I'm trying to detect object and there shadow. These are the result I have for now:Original: 




The external contours of the object are quite good, but as you can see, my object is not full.Same for the shadow.I would like to get full contours, filled, for the object and its shadow, and I don't know how to get better than this (I juste use "dilate" for the moment).Does someone knows a way to obtain a better result please?Regards.




目前方向:图像拼接融合、图像识别 联系方式
计算机视觉 索引
1、OpenCV to detect how missing tooth in equipment Hello everyone. I am just starting with OpenCV and still a bit lost.
1742 0
算法 Android开发 计算机视觉
一、How to make auto-adjustments(brightness and contrast) for image Android Opencv Image Correction i'm using OpenCV for Android.
1255 0
资源调度 计算机视觉 Android开发
2017年4月16日 一周AnswerOpenCV佳作赏析
2017年4月16日 一周AnswerOpenCV佳作赏析 1、HelloHow to smooth edge of text in binary image, based on threshold.Something like anti-aliasing by openCv?example ...
843 0
移动开发 HTML5 定位技术
  现代设计风格的网页设计通常基于强大,先进的网页设计技术,如 HTML5,CSS3 ,网格系统,元素等等。所有的网站都完全响应式设计,并所有设备能够很好的展现。   今天,我们聚集了一组最新的设计例子,相信这些获奖网站设计能为您提供灵感。
838 0
域名解析 移动开发 前端开发
移动开发 JavaScript 前端开发
您可能还喜欢   12个优秀的 HTML5 网站设计案例欣赏 30个漂亮的个人作品集网页设计欣赏 分享35个非常漂亮的单页网站设计欣赏 45个优秀的国外电子商务网站设计欣赏 33个非常优秀的网站底部设计案例欣赏     旅游网站的页面通常设计得很宽,而且搭配非常有吸引力的图片,目的是为了突出视觉吸引力。
1039 0
JavaScript 前端开发 HTML5
  一个有吸引力的作品网站对摄影师来说是非常有价值的资产。今天这篇文章向大家推荐25个最佳摄影师作品网站,从中可以看到很多风格独特的设计,一起欣赏。 Lisa Bettany CirilJazbec Little Hellos Joshua Sterns Christian...
758 0
前端开发 HTML5 移动开发
您可能还喜欢   寻找网页设计灵感的27个最佳网站推荐 最新30个漂亮的个人作品集网页设计案例 分享35个非常漂亮的单页网站设计案例 60佳灵感来自大自然的网页设计作品欣赏 分享100佳精美的作品集网站设计案例     这个系列将向大家分享汇集漂亮网站设计欣赏的200佳网站。
1299 0
Oracle 关系型数据库 MySQL
 最近实在太累了,直到周末搭建好最后一套灾备环境,我悬着的心才终于放下来,总算是给这段时间的忙碌画上了一个句号,随后的几天里就是些修修补补的事情了。    所以周末忙完这波,我好好睡了一觉,一下子闲下来,一下子轻松下来,有一种考完试后的迷茫感。
1050 0
编解码 算法 搜索推荐