I use C++ intead of matlab, but the algorithm is simple. The following algorithm adapt to amplitude and offset error. You can compare thousand of millions pixels per second using it:
Data Algorithm XDX11. An improved high speed algorithm for image ...
Thank you Parul and Aliyu.Yes both of you got my point.I actually need to do windowing filter/granular computing in image.
"Granulation involves decomposition of whole into parts, organization involves integration of parts into whole, and causation involves association of causes and effects’’.A granule is a clump of objects (points), in the universe of discourse, drawn together by indistinguishability, similarity, proximity, or functionality.Granulation leads to information compression/summarization.
Given your question and the provided publication, I understand the basic problem as follows (please correct me if I missed or misunderstood anything):
Instead of defining a pixel-wise global threshold for 'boundary detection' based on binarization (2-class-classification), the processing is done based on a non-overlapping, block-wise approach:
1) The Image is devided into blocks
The m x n sized blocks are called 'Granulars' in this approach. As far as I understood it, it is nothing more, but a common block-based approch with a given blocksize m x n to define the processing window; combined with the requirement that windows do not overlap ...
To my humble opinion the mathematical equations provided in this paper seem to be not correct, or maybe I just failt to understand what it means ...
2) A decision is made if a block (Granular) either belongs to an object or the background
For each analyzed block (Granular) a decision is made, if it belongs to either object or background. In contrast to classical 2-class binarization using a certain thereshold, the decision is made based on an interval of uncertanity, defining a 'lower and higher approximation' of objects and a 'lower and higher approximation of the background.
At this point I possibly fail to understand the provided equations:
The equation for 'inner approximation of the object' (p. 2511) is definied as union of all blocks (Granulars) Gi so that ALL (universal quantifier) pixels Pj exceed a certain threshold T.
The equation for 'outer approximation of the object' (p. 2511) is defined as union of all blocks (Granulars) Gi such that there EXISTS any (existential quantifier) j,j = 1 so that Pj exceeds a certain threshold T.
To be honest I fail to completely understand these equations ... Maybe the inner approximation means that all the pixel of a block needs to exceed the threshold and the outer approximation means at least one of the pixels need to exceed the threshold ... but still that does not seem to make sense to me ...
Afterall, I understand this as a local-adaptive block-based binarization approach, but I fail to understand the equations for inner and outer approximation as well as the provided pseudo-code of the algorithm.
If anyone finds some mistakes in my answer, or might be able to explain this approach in detail, it would be really appreciated...
Ok, i give you a practical approach using OpenCV Library (available for mathlab). Use this library for color detection as in the provided example.
I understand that you don't want a theoretical approach because is easy conclude that you need define a threshold for similarity and compare the pattern with the original pixel and increase counter of similars pixel.
What I don't understand is that how implement this granular approach in matlab secondly how to compute lower and upper approximations background/object from an image?
As far as I understood it the name 'Granular' is nothing more then another name for block. Block-based processing in Matlab is pretty straight-forward, instead of working with every single pixel like this:
[rows, cols] = size(image);
for y = 1:rows
for x = 1:cols
% do something with pixel x,y
end
end
You work with a defined blocksize 'm' where a block is represented by m x m pixels like this:
[rows, cols] = size(image);
blockSize = 8;
for y=1:blockSize:rows
for x=1:blockSize:cols
% check needed, if actual block exceeds image dimensions
block = image(y:y+blockSize-1,x:x+blockSize-1);
% do something with actual block
end
end
As I wrote in my last post I failed to completly understand the equations given in the paper, but the calculation of the inner approximation of the object, would look something like this:
[rows, cols] = size(image);
blockSize = 8;
t = 128;
for y=1:blockSize:rows
for x=1:blockSize:cols
% check needed, if actual block exceeds image dimensions
block = image(y:y+blockSize-1,x:x+blockSize-1);
if(min(block(:) > t) % all pixel values of block > threshold
% the actual block is part of inner approximation
else
% the actual block is not part of inner approximation
end
end
end
I did not test the code snipplets, so there might be errors. You need a special handling if the last block exceeds image dimensions (as marked in the code).
You are welcome, feel free to ask if you encounter any concrete problems with your Matlab implementation.
I took another look into the paper and the equations. As I would understand it:
1) Inner Approximation of Object: If all pixel values of a block exceed threshold T, the block is considered as part of inner approximation, the complete inner approximation is a set of blocks, given as union of all blocks that fullfill condition 1)
2) Outer Approximation of Object: If at least one pixel value of a block exceeds T, the block is considered as part of outer approximation, the complete outer approximation is a set of blocks, given as union of all blocks that fullfill condition 2)
3) Inner Approximation of Background: If all pixel values of a block are less than or equal with respect to threshold T ...
4) Outer Approximation of Background: If at least one pixel value of a block is less than or equal with respect to threshold T ...
I hope I understood that correctly, still a bit confused ... please correct me if needed ...
Thank you once again.You are right but I don't think it is about threshold.It is about pixels belonging to a region on the similarity basis.The extraction of such pixels is a major concern.
I am afraid you are wrong with that, maybe have a look into the paper again.
On page 2511 you find the four equations for inner / outer approximations, as you can see it's all about the threshold T. All four conditions are related to T.