Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to shift the color that i dont need to be black. i know how to use opencv to

ID: 3711938 • Letter: H

Question

How to shift the color that i dont need to be black. i know how to use opencv to detect the color that i needed by hsv image but to be more accurate for compare the image of each row and each column. i want to change the scalar of color which is not match in range to be black at their rows and columns. How to shift the color that i dont need to be black. i know how to use opencv to detect the color that i needed by hsv image but to be more accurate for compare the image of each row and each column. i want to change the scalar of color which is not match in range to be black at their rows and columns.

Explanation / Answer

You can access a pixel value by its row and column coordinates. For BGR image, it returns an array of Blue, Green, Red values. For grayscale image, just corresponding intensity is returned.

Accessing only blue piels

You can modify the pixel values the same way.

Above mentioned method is normally used for selecting a region of array, say first 5 rows and last 3 columns like that. For individual pixel access, Numpy array methods, array.item() and array.itemset() is considered to be better. But it always returns a scalar. So if you want to access all B,G,R values, you need to call array.item() separately for all.

Better pixel accessing and editing method :

100

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote