Find quantity of pixels within a spectral distance from a given [r,g,b] spectra.
Spectral distance = sqrt( (r0-ri)^2+(g0-gi)^2+(b0-bi)^2) where [r0,g0,b0] is the target spectra (0:255) and [ri,gi,bi] are from an image pixel.
Two warm-up timing prep runs will be executed against a 512x512 sub-section.
Timing run will be against a 2036x3060 image : concordaerial.png
A second test will select a random point in a small window to confirm accuracy. Unfortunately bwdist does not appear to work in Cody.
Ranking will be based upon speed. Accuracy is still required.
Input: [image array, spectra, threshold distance]
image array [ x, y, 3 ] % Higher order images is a future activity
spectra [ r g b]
Output: [ N ] number of pixels within(<=) threshold distance
Pixel count tolerance of 1% is allowed
The right to update the test points/thresholds is reserved in case of shenanigans.
Solution Stats
Problem Comments
7 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers10
Suggested Problems
-
4183 Solvers
-
661 Solvers
-
Find the stride of the longest skip sequence
177 Solvers
-
1448 Solvers
-
Arrange vector in ascending order
817 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Error: File "concordaerial.png" does not exist. :-(
>> which concordaerial.png
C:\MATLAB\R2016b\toolbox\images\imdata\concordaerial.png
This problem is not solvable any more because it the test suite requires image toolbox support, which is not available on Cody any more.
Change the imread line to >> A=imread(fullfile(matlabroot,'toolbox','images','imdata','concordaerial.png')); and it will work.
The line referenced by Rafael S.T. Vieira (and prior comments) has been corrected.
Thanks once again, goc3, the problem is currently working. :)
cool stuff man
The image used in the test suite appears to be unavailable.