Message Boards Message Boards

0
|
5481 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Image processing: draw lines or polygons on object

Posted 9 years ago

I am looking for image processing functions to draw lines or polygons on selected objects (please see attached image. Source:

http://www.wolfram.com/solutions/industry/image-processing/information-kit/content/ImageProcessingFlyer.pdf

I tried but could not find a right function. I really appreciate inputs from somebody who knows it.

Thank you very much.

Image Processing

POSTED BY: Eiji Matsuzaki

Hi,

this is only the main idea. The process is not optimised. I don't have your image, so I take an example image:

![img = ExampleData\[{"TestImage", "JellyBeans2"}\];][1]

Now we can use MorphologicalPerimeter to identify edges and then ImageCompose to combine the images.

ImageCompose[img, {MorphologicalPerimeter[img, 0.6], 0.4}]

enter image description here

If you want black lines it looks like this:

ImageCompose[img, {ColorNegate[MorphologicalPerimeter[img, 0.6]], 0.3}]

enter image description here

You can also use ImageMultiply

ImageMultiply[img, ColorNegate[MorphologicalPerimeter[img, 0.6]]]

enter image description here

ImageAdd can also work:

ImageAdd[img, MorphologicalPerimeter[img, 0.6]]

enter image description here

You might also want to either Binarize or remove the Background first.

ImageCompose[img, {MorphologicalPerimeter[RemoveBackground[img, White], 0.2], 0.4}]

enter image description here

It's playing a bit around with parameters and related functions. In fact, there are more ways of achieving the same effect. I hope that the ones I pointed out will be useful for you.

Cheers,

Marco

POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract