外国不过十一,所以利用十一假期,看看他们都在干什么。

一、小白问题
http://answers.opencv.org/question/199987/contour-single-blob-with-multiple-object/
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 http://answers.opencv.org/question/71... - I struck up with choosing the points that will separate the object.

I have attached a sample contour for the reference.

Please suggest any comments to separate the objects.

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

二、性能优化
http://answers.opencv.org/question/109754/optimizing-splitmerge-for-clahe/
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();
    clahe->setClipLimit(4);
    vector <Mat> hsvChannels;
    Mat img, hsv1, hsv2, hsvChannels2, diff;
    img = imread("lena.jpg");
    cvtColor (img, hsv1, COLOR_BGR2HSV);
    cvtColor (img, hsv2, COLOR_BGR2HSV);
    tm.start();
for (int i = 0; i < 1000; i++)
{
        split(hsv2, hsvChannels);
        clahe->apply(hsvChannels[2], hsvChannels[2]);
        merge(hsvChannels, hsv2);
}
    tm.stop();
    cout<< tm << endl;
    tm.reset();
    tm.start();
 
for (int i = 0; i < 1000; i++) 
{
        extractChannel(hsv1, hsvChannels2, 2);
        clahe->apply(hsvChannels2, hsvChannels2);
        insertChannel(hsvChannels2, hsv1, 2);
}
    tm.stop();
    cout<< tm;
    absdiff(hsv1, hsv2, diff);
    imshow("diff", diff*255);
    waitKey();
}
我运行这段代码的结果为:
4.63716sec
3.80283sec
应该说其中关键的一句就是使用:
extractChannel(hsv1, hsvChannels2, 2);
代替
split(hsv2, hsvChannels);
能够单句提高1MS左右时间,而这种费时的方法是我目前经常采用的,应该说这题很有较益。

三、基本算法

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
add a comment

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;

for(;;)
{
    //Getting a frame from the video capture device.
    cap >> currentFrame;

if( prevFrame.data )
    {
         //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.
    if(waitKey(30)>=0)
        break;

//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

这道题难道不是对absdiff的应用吗?直接absdiff,然后阈值,数数就可以了。

四、系统配置
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 )

i tried to explain the steps

Step 1.download https://github.com/DanBloomberg/lepto...

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"

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 created


Step 2.download https://github.com/tesseract-ocr/tess...

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

E:\tesseract-3.05.01\api

E:\tesseract-3.05.01\ccmain

E:\tesseract-3.05.01\ccutil

E:\tesseract-3.05.01\ccstruct

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
禾路按语:OCR问题,一直都是图像处理的经典问题。那么tesseract是这个方向的非常经典的项目,包括east一起进行结合研究。
五、算法问题
Pyramid Blending with Single input and Non-Vertical Boundar

Hi All,

Here is the input image.

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

Comments

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

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
add a comment
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:

Object:

Shadow:

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.

有趣的问题,研究看看。

来自为知笔记(Wiz)

转载于:https://www.cnblogs.com/jsxyhelu/p/9752650.html

AnswerOpenCV(1001-1007)一周佳作欣赏相关推荐

  1. AnswerOpenCV(0826-0901)一周佳作欣赏

    1.OpenCV to detect how missing tooth in equipment Hello everyone. I am just starting with OpenCV and ...

  2. 朱自清 佳作欣赏 《匆匆》

    朱自清 佳作欣赏 <匆匆> 燕子去了,有再来的时候:杨柳枯了,有再青的时候:桃花谢了,有再开的时候.但是,聪明的,你告诉我,我们的日子为什么一去不复返呢?--是有人偷了他们吧:那是谁?又藏 ...

  3. 乐高创意机器人moc_乐高MOC佳作欣赏丨机械之美机器人乐高作品集1

    导语 乐高似乎能搭建任何事物,即使是机器人,机甲也不丝毫逊色,巧妙地运用零件,打破常规组合模式,让乐高零件组合在一起竟能呈现充满未来科技感的机器人,它们有的形态奇特,面貌诡异,有的小巧精致,有的炫酷夺 ...

  4. 磨金石教育摄影技能干货分享|杨元惺佳作欣赏——诗意人文

    一般来说,人文摄影总会体现现实性多些. 但杨老师是个摄影诗人,他的内心总能将刻板的现实融入美好的光芒. 你在他的照片里,看着现实的摄影素材,所感受到的是诗意的绵绵未尽. 春网(中国) 正所谓春水碧于天 ...

  5. 老周语录-做出好产品的关键

    周鸿祎在微博分享了一篇点评<遗失的乔布斯访谈>的文章,摘自乔布斯在1995年的一个纪录片,讲了他对团队.人才.产品.流程等看法.心有戚戚焉.文中提到的几点感同身受,整理如下. 1. 会制造 ...

  6. 20170916导出fuck 7654导航

    Bookmarks 书签栏 unity Unity游戏开发有哪些让你拍案叫绝的技巧? [Unity3D学习 愤怒的小鸟攻略技巧秘籍 unity3d技巧 unity3d愤怒的小鸟实现 unity3d切换 ...

  7. java 剔除工作日计算超时时间

    剔除工作日计算超时时间 import com.alibaba.fastjson.JSONObject;import java.math.BigDecimal; import java.text.Par ...

  8. English学习资料大全

    From http://www.cnblogs.com/lyss/archive/2006/05/28/400639.html 多语言翻译 http://www3.j-server.com/KODEN ...

  9. 好文推荐 | 从数据的属性看数据资产

    编辑说 数据资产化是发挥数据要素价值.培育数据要素市场的必经之路.发展数据要素市场是未来数字经济健康.快速.持续发展的基础,而数据资产化是数据成为生产要素的前提.数据资产是一类新的资产类别,对其涉及的 ...

最新文章

  1. ADAS可行驶区域道路积水反光区域的识别算法
  2. ORA-01113 file 1 needs media recovery
  3. CVPR 2020 论文开源项目一页看尽,附代码论文
  4. SAP从业者群里讨论SAP技术的更新换代问题
  5. 钢琴块2电脑版_快陪练教师端电脑版下载_快陪练教师端pc版免费下载[在线教学]...
  6. zookeeper 负载均衡 概念笔记
  7. html li占用两行,谁帮我解决一下LI上下两行错位的BUG。_html/css_WEB-ITnose
  8. Redis集群搭建与简单使用
  9. linux emule 编译 wx-config --libs,Linux下的wxWidgets静态编译实现方法
  10. openstack nova调用libvirt,跟踪libvirt源码实例详解(cpu_mode及live_migrate 错误解决)...
  11. Java 正则表达式处理复杂文本,效率就是高!
  12. 自制试题(逻辑思维训练500题)
  13. 观看影片《硅谷传奇》
  14. 卸载wps后安装office图标异常的问题
  15. 16. Zigbee应用程序框架开发指南 - 扩展ZigBee Cluster Library (ZCL)
  16. UC缓存的php格式视频,UC缓存视频变成本地mp4_下载视频怎么转换mp4_我的下载站
  17. python自学第七天之字典的增删改查
  18. 十门峡旅游攻略:临安十门峡的春天
  19. 安卓APP开发发展趋势与前景
  20. ITSM-CMDB数据库设计-四种方案任你选

热门文章

  1. FP Tree算法原理总结(转)
  2. mysql安装教程刘猿猿_mysql安装
  3. linux安装库文件下载,Linux下的Curses库的下载与安装
  4. 【sklearn学习】模型网格化调参
  5. 2019.9.17最小生成树知识点回顾
  6. pycharm打包.py程序为可执行文件exe
  7. 玩转mini2440开发板之【tekkamanninja版的u-boot的编译和烧录】
  8. (转)FPGA的速度等级(speed grade)
  9. sublime txt常用插件推荐
  10. 现在是不是很多人都不愿意在银行存钱?