How do I perform an RGB threshold?
Afficher commentaires plus anciens
Create a function called Perform_RGB_threshold. Your function header should look like:
function [threshold_RGB] = Perform_RGB_threshold(image_RGB, thrper)
The result of performing a LOG operation on the sample image that you download will be an array with a very wide range of numbers (approximately -2000 to +2000). As a result, you will see a double line effect on the edges of the image after you perform the LOG. We would like to clean up those edges so that we only see nice clean white lines on a black background. Thresholding is an operation often used to generate black and white images. For this function we’ll also use it to rescale the image so that all of the final values fall in the range 0 to 255. (Although in this case, the output pixels will ONLY be 0 or 255.) You will want to convert each pixel in the input image to either a black pixel (value 0) or a white pixel (255) depending on whether the pixel in the input image image_RGB is less than a threshold value or not. You will calculate a threshold value for each color layer in the image based on the threshold percent (thrper) given as an input parameter. For example, the main script file calls this function with the value .75 as thrper. This means that the function will convert pixels with values in the bottom 75% of the full range to black (new value = 0) and the pixels with values in the top 25% of the full range to white (new value = 255). For example, if the red layer values range from -100 to +300, then the red threshold value for a thrper of .75 would be 200.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Image Processing Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!