Hi all,
I am using Magick .NET 7 successfully in a multithreaded application. Especially after the last release, it no longer crashes with a Memory Access Violation. I mainly use crop and convert to black/white and using that picture in tesseract for OCR.
Anyway, now I have a new function I need to write and I was wondering if I can receive a result without pixel by pixel check:
I have a picture and I want to extract the (y-) Position of the pixel for each column (not row) with the lowest blue value in RGB.
Lowest blue value is coincidentially the best minimal data to identify that pixel.
My target is to extract a set of x/y coordinates of a MagickImage which is a chart.
Is there any other way than checking each pixel one by one?
Thanks in advance
Question if a builtin function is available (lowest blue value in column)
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Question if a builtin function is available (lowest blue value in column)
Every pixel has to be checked, unless you find a zero in a column, and then you can ignore the rest of the column.
I don't think Magick.NET has any shortcuts to this.
Do you need to process every column? If so, the obvious methods are:
1. For each column, find the lowest blue value. OR:
2. Create a temporary array of [width] structures, for the smallest value and y-position. For each row, update the elements of the array.
Method (2) is messier, but may be quicker, because IM is optimised to process row-by-row rather than column-by-column.
I don't think Magick.NET has any shortcuts to this.
Do you need to process every column? If so, the obvious methods are:
1. For each column, find the lowest blue value. OR:
2. Create a temporary array of [width] structures, for the smallest value and y-position. For each row, update the elements of the array.
Method (2) is messier, but may be quicker, because IM is optimised to process row-by-row rather than column-by-column.
snibgo's IM pages: im.snibgo.com
Re: Question if a builtin function is available (lowest blue value in column)
Hi Snibgo,
thanks for the info!
Luckily I don't need to check every pixel. If the blue value raises, it is clear that it "passed" already the minimum.
First I'll try by column, and then by row. Do you know/think if a Parallel.Foreach would work better or is the Parallel overhead to high?
I guess I have to try.
Kind regards,
Surion
thanks for the info!
Luckily I don't need to check every pixel. If the blue value raises, it is clear that it "passed" already the minimum.
First I'll try by column, and then by row. Do you know/think if a Parallel.Foreach would work better or is the Parallel overhead to high?
I guess I have to try.
Kind regards,
Surion
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Question if a builtin function is available (lowest blue value in column)
Yes, because the answer will depend in the image size, number of cores, phase of the moon and other factors.Surion wrote:I guess I have to try.
snibgo's IM pages: im.snibgo.com