JuliaImages / Images.jl

An image library for Julia
http://juliaimages.org/
Other
530 stars 141 forks source link

Add findContours and related functions to the lib #859

Open fmvin opened 4 years ago

fmvin commented 4 years ago

Please add to the library similar functions existed in opencv "Structural Analysis and Shape Descriptors" to manipulate with contours:

Tokazama commented 4 years ago

Take a look at https://juliaimages.org/latest/function_reference/#Morphological-operations-1.

fmvin commented 4 years ago

Take a look at https://juliaimages.org/latest/function_reference/#Morphological-operations-1.

Thanks a lot. Could you please give any clue how to find contours and calculate each area in this question.

Tokazama commented 4 years ago

I'm not really a CV expert so there may be a more optimized way of doing things, but until someone else jumps in here I'd suggest using https://juliaimages.org/latest/imagesegmentation/#ImageSegmentation.jl-1. The best (fastest/accurate) segmentation algorithm will depend on characteristics of the image you have. Once you have the segmented image you only need to count the number of pixels identified in the segmented region.

You can find a lot of this just by searching the docs (search box is in the top left corner).

fmvin commented 4 years ago

Approaches you mentioned above are not "just from box" as it is in opencv. In opencv I take a color image and just call:

  1. cvtColor with cv::COLOR_BGR2GRAY
  2. findContours

And to analyse contour's shape:

  1. contourArea
  2. arcLength
  3. approxPolyDP
  4. boundingRect

This is all what I'm expecting from this lib.

johnnychen94 commented 4 years ago

That might not be supported in the near future if there aren't any other people contributing to it. Images.jl has some functionalities to enable users to process images if they know how to achieve it, however, there's still a lot of work to do to provide a toolbox of all out-of-box algorithms for end-users; finetuning those algorithms isn't an easy task.

Tasks of higher priority at present as far as I understand are: polishing the core package ImageCore.jl, update the documentation and stabilize the core API for v1.0.

By saying this, we'd love to accept any PRs to https://github.com/JuliaImages/ImageFeatures.jl and https://github.com/JuliaImages/ImageSegmentation.jl

timholy commented 4 years ago

This is all what I'm expecting from this lib.

I'd urge you to distinguish "want" and "expect." I can understand why you want it, but why do you expect it? In open source, the availability of a feature comes down to some person who wants something deciding to donate their time and contribute it. If no one has done that yet for the features you need, your choices are to do it yourself or wait patiently until some kind soul does so. There should be no expectations that others will do your work for you for free.

zygmuntszpak commented 4 years ago

I'm working on precisely this type of functionality over at ImageComponentAnalysis.jl

The current registered version supports the following:

Basic Measurements

  1. Area
  2. Perimeter

    Basic Topology

  3. Euler number (4 connectivity)
  4. Euler number (8 connectivity)
  5. Bit Quad Patterns

    Bounding Box

  6. Minimum Enclosing Rectangle
  7. Oriented Minimum Enclosing Rectangle

In the src/TODO folder you will find two implementations of contour tracing algorithms: costa_outer.jl and moore_inner.jl. There is also an implementation of a moment-based ellipse fit in region_ellipse.jl. I haven't yet integrated these functions properly into the package API, and I still have to decide on the convention for reporting the ellipse orientation. I am currently working on implementing a contour tracing algorithm that can determine its surrounding topological relation with other contours.

I intend to move the package to the JuliaImages repository once I have finished crafting the basic version.

fmvin commented 4 years ago

@timholy

I'd urge you to distinguish "want" and "expect."

I apologise if I used inappropriate verb in this community ;) English is not my native language.

Tokazama commented 4 years ago

@fmvin I don't quite understand what you mean by "just from box". If you mean there is a single function that does what you want for each of those you already have some available. Like any toolbox or language (coding or spoken) there will be things that don't translate exactly. So I tried pointing you towards functions that do similar things. If you read the documentation you will find that most of those functionalities aren't difficult to perform on one's own with a couple lines of code. So if you are really familiar with OpenCV you might just have to think a little bit about what you're doing the first time you do it in Julia.

I apologise if I used inappropriate verb in this community ;) English is not my native language.

If the problem is that you need the docs in another language you can make a separate issue for that (even better make a PR helping solve the issue for others). Translation may even be a good way of getter better at both subjects at once if you're a student.

fmvin commented 4 years ago

@Tokazama

If you read the documentation you will find that most of those functionalities aren't difficult to perform on one's own with a couple lines of code.

If this is so easy to do in 2 lines of code please tell then why @zygmuntszpak is working on this functionality right now. And you wrote 2 long post instead of 2 lines of code as example which helps at least 2 people to move forward in his tasks. Also it will be grateful to include your example to official docs ;)

@zygmuntszpak I'm waiting for your package with patience. Thanks a lot for your contribution.

tomasBjornfot commented 3 years ago

You can use https://github.com/JuliaGeometry/Contour.jl

aditi-dey29 commented 1 year ago

Has this issue been dealt with? If not I’ll like to work on implementing these functions. Should I start working?

ashwani-rathee commented 1 year ago

Hey @aditi-dey29 , Thank you for showing interest in the issue. You can sure start working on it. I would suggest you to read the discussion above and join image processing channel in Julia slack to clear your doubts.

aditi-dey29 commented 1 year ago

@ashwani-rathee thanks! just joined the channel.

RiTomasBjornfot commented 1 year ago

There is an very nice implementation of finding contours in images here: https://github.com/JuliaGeometry/Contour.jl I have used it in several projects and it works excellent.