I am just starting to learn C++ and I need to ask you. Is it possible to create array or object where I could create element under index starting not from zero but e.g. 25?
Situation which I want to describe. I have image with white background. First row contains few pixels in black color. There are pixels (x coord) 23, 24 and 25 are black. There can be also some other black areas, but let's suppose 26 is white. According formula Iyn=[x1,x2] I want to get the lower value (x1) of the limit and the upper value (x2). So I want to make method to get ( in this particular case the limit Iyn=[23,25] ) .
(Illustration of the black pixels in the image row 1-5, up to column 26; the grid illustrates the positions of the pixels; the pixels are the big black blots)
I would like to do it like so:
I plan to read image row by row (or column by column). For every row I would like to use for loop to analyse whether the previous pixel has same color (*) - if yes, then set a value in array. However to have efficient performance I need this direct access. So if I analyse row=1 and found that pixel with coord x=25 is same color like the previous pixel (x=24), later I wound need to access it directly by value 25. If I found that the next pixel does not contain same color so I would save the lower limit x1 into the array myarr[y][x1]=x2.
I know that C++ makes arrays starting from index 0 and probably this is not possible to do by array, but maybe some kind of object? The reason why I want to do so is that later, when I would want to use the array to analyse the groups (black lines), I would need to compare pixel from previous row and group (e.g. first row and first black line) with the actual row (e.g. second row and first line in this row). In the case that they are same color, I would simply join the one group with the second group (So I would found that these two lines from different rows are common area, black shape or rectangle). When doing this comparison it would be much more faster to make condition testing access to certain element like myarr ... if true, then ok, these lines are together. If this element does not exist, than it means, that there is different color...
I tried to explain this as simple as possible, I hope you can understand what I try to do.
* Notes - I can make method to compare with a fuzz, so the goal for comparison method would be to find similar color, which has certain fuzz. But for simplicity of this example, lets use just two colors.