久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

圖像處理:'Coca-Cola Can' 識別的算法改進

Image Processing: Algorithm Improvement for #39;Coca-Cola Can#39; Recognition(圖像處理:Coca-Cola Can 識別的算法改進)
本文介紹了圖像處理:'Coca-Cola Can' 識別的算法改進的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

過去幾年我參與過的最有趣的項目之一是關于 庫在 C++ 中完成.

預處理:對于圖像預處理,即將圖像轉換為更原始的形式以提供給算法,我使用了兩種方法:

  1. 將顏色域從 RGB 更改為 在 2 個先行步驟后獲取所有項目的輪廓.

算法:我為此任務選擇的算法本身取自 (SIFT) 或

  • 獨特的圖像特征來自尺度不變的關鍵點
  • ORB:SIFT 或 SURF 的有效替代方案
  • One of the most interesting projects I've worked on in the past couple of years was a project about image processing. The goal was to develop a system to be able to recognize Coca-Cola 'cans' (note that I'm stressing the word 'cans', you'll see why in a minute). You can see a sample below, with the can recognized in the green rectangle with scale and rotation.

    Some constraints on the project:

    • The background could be very noisy.
    • The can could have any scale or rotation or even orientation (within reasonable limits).
    • The image could have some degree of fuzziness (contours might not be entirely straight).
    • There could be Coca-Cola bottles in the image, and the algorithm should only detect the can!
    • The brightness of the image could vary a lot (so you can't rely "too much" on color detection).
    • The can could be partly hidden on the sides or the middle and possibly partly hidden behind a bottle.
    • There could be no can at all in the image, in which case you had to find nothing and write a message saying so.

    So you could end up with tricky things like this (which in this case had my algorithm totally fail):

    I did this project a while ago, and had a lot of fun doing it, and I had a decent implementation. Here are some details about my implementation:

    Language: Done in C++ using OpenCV library.

    Pre-processing: For the image pre-processing, i.e. transforming the image into a more raw form to give to the algorithm, I used 2 methods:

    1. Changing color domain from RGB to HSV and filtering based on "red" hue, saturation above a certain threshold to avoid orange-like colors, and filtering of low value to avoid dark tones. The end result was a binary black and white image, where all white pixels would represent the pixels that match this threshold. Obviously there is still a lot of crap in the image, but this reduces the number of dimensions you have to work with.
    2. Noise filtering using median filtering (taking the median pixel value of all neighbors and replace the pixel by this value) to reduce noise.
    3. Using Canny Edge Detection Filter to get the contours of all items after 2 precedent steps.

    Algorithm: The algorithm itself I chose for this task was taken from this awesome book on feature extraction and called Generalized Hough Transform (pretty different from the regular Hough Transform). It basically says a few things:

    • You can describe an object in space without knowing its analytical equation (which is the case here).
    • It is resistant to image deformations such as scaling and rotation, as it will basically test your image for every combination of scale factor and rotation factor.
    • It uses a base model (a template) that the algorithm will "learn".
    • Each pixel remaining in the contour image will vote for another pixel which will supposedly be the center (in terms of gravity) of your object, based on what it learned from the model.

    In the end, you end up with a heat map of the votes, for example here all the pixels of the contour of the can will vote for its gravitational center, so you'll have a lot of votes in the same pixel corresponding to the center, and will see a peak in the heat map as below:

    Once you have that, a simple threshold-based heuristic can give you the location of the center pixel, from which you can derive the scale and rotation and then plot your little rectangle around it (final scale and rotation factor will obviously be relative to your original template). In theory at least...

    Results: Now, while this approach worked in the basic cases, it was severely lacking in some areas:

    • It is extremely slow! I'm not stressing this enough. Almost a full day was needed to process the 30 test images, obviously because I had a very high scaling factor for rotation and translation, since some of the cans were very small.
    • It was completely lost when bottles were in the image, and for some reason almost always found the bottle instead of the can (perhaps because bottles were bigger, thus had more pixels, thus more votes)
    • Fuzzy images were also no good, since the votes ended up in pixel at random locations around the center, thus ending with a very noisy heat map.
    • In-variance in translation and rotation was achieved, but not in orientation, meaning that a can that was not directly facing the camera objective wasn't recognized.

    Can you help me improve my specific algorithm, using exclusively OpenCV features, to resolve the four specific issues mentioned?

    I hope some people will also learn something out of it as well, after all I think not only people who ask questions should learn. :)

    解決方案

    An alternative approach would be to extract features (keypoints) using the scale-invariant feature transform (SIFT) or Speeded Up Robust Features (SURF).

    You can find a nice OpenCV code example in Java, C++, and Python on this page: Features2D + Homography to find a known object

    Both algorithms are invariant to scaling and rotation. Since they work with features, you can also handle occlusion (as long as enough keypoints are visible).

    Image source: tutorial example

    The processing takes a few hundred ms for SIFT, SURF is bit faster, but it not suitable for real-time applications. ORB uses FAST which is weaker regarding rotation invariance.

    The original papers

    • SURF: Speeded Up Robust Features
    • Distinctive Image Features from Scale-Invariant Keypoints
    • ORB: an efficient alternative to SIFT or SURF

    這篇關于圖像處理:'Coca-Cola Can' 識別的算法改進的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

    【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

    相關文檔推薦

    What is the fastest way to transpose a matrix in C++?(在 C++ 中轉置矩陣的最快方法是什么?)
    Sorting zipped (locked) containers in C++ using boost or the STL(使用 boost 或 STL 在 C++ 中對壓縮(鎖定)容器進行排序)
    Rotating a point about another point (2D)(圍繞另一個點旋轉一個點 (2D))
    How do I construct an ISO 8601 datetime in C++?(如何在 C++ 中構建 ISO 8601 日期時間?)
    Sort list using STL sort function(使用 STL 排序功能對列表進行排序)
    Is list::size() really O(n)?(list::size() 真的是 O(n) 嗎?)
    主站蜘蛛池模板: 91精品国产综合久久久久久 | 久久成人av | av一区在线 | 日本久久一区二区三区 | 日日操夜夜操视频 | 国产精品久久久久久亚洲调教 | 在线男人天堂 | 在线综合视频 | 91视频在线看 | 国产精品久久久久久久一区探花 | 婷婷色在线 | 999精彩视频 | 狠狠操狠狠干 | 操操日 | 狠狠综合久久av一区二区小说 | 日韩在线成人 | 亚洲精品乱码久久久久久蜜桃 | 狠狠的干 | 精品一区二区在线观看 | 欧美日韩视频网站 | 亚洲精品久久久久久下一站 | 国产福利在线小视频 | 特级黄一级播放 | 欧美乱人伦视频 | 亚洲综合一区二区三区 | 日韩欧美国产一区二区三区 | 欧产日产国产精品视频 | 亚洲欧洲一区 | 国产欧美在线一区二区 | 亚洲成人中文字幕 | 夜操| www.日本在线观看 | 91一区二区三区 | av黄色片在线观看 | 欧美片网站免费 | 亚洲vs天堂 | 成人h片在线观看 | 精品国产乱码久久久久久丨区2区 | 日日噜噜夜夜爽爽狠狠 | 亚洲国产精品一区二区三区 | 91色站 |