15,997,591 members
See more:
Hello,I have a bitmap including pixels.I want to have something like a list of the sorted pixels so that I can reach their color,original place ,etc.What's the solution?Should I have a list of strictures_including color and place of pixels?If so,how can I sort the structures by one of their parts(color)?Here is the algorithim I'm trying to write with name:"Algorithm 4.1 Vincent-Soille watershed algorithm [52]."
in pdf named:"The Watershed Transform: De nitions, Algorithms and
Parallelization Strategies"
Posted
Updated 14-Jul-11 22:17pm
v2

## Solution 1

Why would you want to do that? All you will get is a data set that is bigger than the original bitmap by huge amounts: the location data alone will be 32 bits - the same size as a ARGB pixel - without the colour information, or list overhead.

What are you trying to do that you think you need this?

I want to write watershed algorithim which determines the areas of the picture(according to the color).One of the steps in the algorithim I found is what I explained.after all I would be so thankfull if you help me to solve my problem or give me another watershed algorithim which doesn't cost this problem.

## Solution 2

I would suggest to use `System.Collection.Generic.Dictionary<Color, System.Collections.Generic.List<Point>>`. It would index all pixel locations by the color (ARGB) with pixels of identical color put in the same list. However, I'm not sure this is exactly what needs to be done at first step. Rather you will need to merge close colors in a single "average" color before classifying them, with parametric criterion for the colors to be considered "close". Nevertheless, the same data structure would help.

—SA

v3

## Solution 3

asma_from_yazd wrote:
I want to have something like a list of the sorted pixels so that I can reach their color,original place ,etc.What's the solution?
1. Choose the sorting criterion.
2. Sort the pixels according to the choosen sorting criterion.

No more, no less.

However, as OriginalGriff noted, without (yours) further explanations, we can hardly find useful such a operation.

I explaned more for OriginalGriff ,please read my explanation,besides I should say I want that list sorted by color so that I start from the least integer(color),go on, and reach the pixcels which have that color.I will show you the algorithim If I can
CPallini 15-Jul-11 4:08am
Hence you need 'just' sorted list of positions (color number being the list key).