C++ 이미지 처리, 입자 계산 (C++ image processing, counting particles)


문제 설명

C++ 이미지 처리, 입자 계산 (C++ image processing, counting particles)

이미지의 입자 수를 계산하고 싶습니다. http://imagej.net/Particle_Analysis 필요한 작업을 정확히 수행하는 ImageJ를 찾았지만 Java이고 통합해야 하는 기능 중 하나일 뿐이므로 C++ 응용 프로그램에서 Java 프로그램을 호출하는 것은 가치가 없습니다. 나는 이것을 구현하는 C++ 라이브러리를 찾고 있는데, 어떤 포괄적인 알고리즘도 환영합니다. 최고입니다


참조 솔루션

방법 1:

I think CImg would be a great solution for you ‑ it is here. It is single C++ header file ‑ no libraries or anything to link and it runs on just about any platform ‑ Linux, OS X, Windows.

The function you need is label(). Here is a short example:

#include <iostream>
#include "CImg.h"
using namespace std;
using namespace cimg_library;

int main(int argc, char** const argv)
{
    CImg<int> img("input.png");
    img.label(0,0);
    img.save_png("result.png");
}

I made a test image with ImageMagick like this at the command line:

convert ‑size 1000x1000 xc:black ‑fill white \
  ‑draw "rectangle 10,10 50,50"              \
  ‑draw "rectangle 100,200 300,400"          \
  ‑draw "rectangle 800,25 900,900" input.png

It looks like this:

enter image description here

Then, when you run the program it labels each blob (i.e. rectangle) with an increasing number, i.e. each one is a bit brighter than the last.

enter image description here

방법 2:

have a look at openCV http://opencv.org/. They have a plethora of functions and algorithms related to computer vision. Depending on the shape and structure of the particles in your image the SimpleBlobDetector() may or may not be usefull. There is a good tutorial here: https://www.learnopencv.com/blob‑detection‑using‑opencv‑python‑c/.

Alternativly you could try implement your own algorithm? Have a search for Laplacian of Gaussian kernel. If your particles are an irregular shape, it may become more difficult and require thresholding and contoring.

(by eien sakebeMark SetchellTomJ)

참조 문서

  1. C++ image processing, counting particles (CC BY‑SA 2.5/3.0/4.0)

#C++ #image-processing #algorithm






관련 질문

파일의 암호화/복호화? (Encryption/ Decryption of a file?)

이상한 범위 확인 연산자가 있는 C++ typedef (C++ typedef with strange scope resolution operator)

개체 배열 매개변수--오류: '문자' 필드에 불완전한 유형이 있습니다. (Object array parameter--error: field ‘letters’ has incomplete type)

C++에서 메모리 삭제 (Deleting memory in c++)

C++ 프로그램을 실행할 수 없습니다. No se ejecuta el programa (C++ i can't run a program. No se ejecuta el programa)

컴파일 시 변수의 이름과 수명 (Name and lifetime of variables at compile time)

control-c 후 Visual Studio 콘솔 프로그램 충돌 (visual studio console program crashes after control-c)

멤버 변수에 std::enable_if 또는 유사한 메서드 사용 (Using std::enable_if or similar method on member variable)

ifstream input_file(filename); (I am receiving an error "no matching function to call" in the line ifstream input_file(filename);)

ESP8266에서 잠시 실행하면 JsonData 크기가 0이 됩니다. (JsonData size becomes zero after awhile of running in ESP8266)

합에 대한 속도 문제(제수의 합) (Speed problem for summation (sum of divisors))

벡터 벡터에서 하위 벡터의 첫 번째 값을 찾기 위해 begin() 및 end() 반복기의 범위를 지정하는 방법은 무엇입니까? (How to specify a range for begin() and end() iterators to find first value of sub vector in a vector of vectors?)







코멘트