snippetMinor
How can I compute the time complexity of this image processing algorithm?
Viewed 0 times
thiscantheimagecomputetimealgorithmhowprocessingcomplexity
Problem
Well, my question is simple, I would like to compute the complexity time of an algorithm related to image processing.
I simplified the algorithm ... so that we focus only on the problematic part.
Algorithm
You have an image/matrix of $N =n \times m$ size and a block of size $b \times b$ (block is just a window or rectangle that will slid through the picture of pixels or the matrix of intensities).
The algorithm goes through most pixels in the image (as center of the block, so it may step over the end of the line or the beginning) by a step of size $s$. The step is inferior to the size of the block $s
Any help, or reference related to this topic is a welcome.
I simplified the algorithm ... so that we focus only on the problematic part.
Algorithm
You have an image/matrix of $N =n \times m$ size and a block of size $b \times b$ (block is just a window or rectangle that will slid through the picture of pixels or the matrix of intensities).
The algorithm goes through most pixels in the image (as center of the block, so it may step over the end of the line or the beginning) by a step of size $s$. The step is inferior to the size of the block $s
Any help, or reference related to this topic is a welcome.
Solution
We need to estimate how many times block operation is performed.
Now we have that block processing will be performe $O(NM/S^2)$ times for whole input. And result time-complexity for whole algorithm will be $O(NM*B^2/S^2)$.
- First lets answer in how many rows we will start block processing - easy to see that each $S$ row are taken into account, so answer to this sub-question is $O(N/S)$. If we suppose that $N$ - number fo rows and $M$ number of columns.
- Then we need answer to question - how many times we will run block processing for each row, due to we perform processing of blocks that starts only in each $S$ columns - answer for this sub-question will be $O(M/S)$.
Now we have that block processing will be performe $O(NM/S^2)$ times for whole input. And result time-complexity for whole algorithm will be $O(NM*B^2/S^2)$.
Context
StackExchange Computer Science Q#44511, answer score: 3
Revisions (0)
No revisions yet.