Color detection in an image and mathematical formula

asked 2018-01-11 17:51:20 -0600

quiques gravatar image

Hello, I have a question, I have done the color detection in an image with python and opencv, but they tell me that there are different ways and that I apply the others together with a mathematical formula, but I can not find anything, someone can help me

edit retag flag offensive close merge delete

Comments

I am not getting your question. Explain your question in detail.

aniket1 gravatar imageaniket1 ( 2018-01-13 03:29:16 -0600 )edit

ok, I use the following to detect a color in an image, but I need to know what formula is based on the code, does anyone know?

import cv2 import numpy as np

imagen = cv2.imread('entrada/9.jpg') imagen2 = cv2.resize(imagen, (1280,680))

Mis colores

cafes_bajos = np.array([60,70,99], dtype=np.uint8) cafes_altos = np.array([21,57,71], dtype=np.uint8) mask = cv2.inRange(imagen2, cafes_altos, cafes_bajos) ingray = cv2.bitwise_and(imagen2,imagen2, mask= mask) cv2.imshow('Grises', ingray) cv2.imshow('Imagen', imagen2) cv2.imshow('Final', mask)

Salir con ESC

while(1): tecla = cv2.waitKey(5) & 0xFF if tecla == 27: break

cv2.destroyAllWindows()

quiques gravatar imagequiques ( 2018-01-14 19:13:44 -0600 )edit

Let assume you have RGB image. here you are finding minimum and maximum intensities values of R,G,B channel for object you have to segment/threshold from image. after that you go to every pixels in a image an check does that pixel value lies in the range, if its lies in the range then you will assign that pixel with 255 else 0. sample code in matlab does that.

rchannel = image[:,:,0] gchannel = image[:,:,1] bchannel = image[:,:,2]

thresholded =bchannel > bLow & bchannel< bHigh & gchannel > gLow & gchannel <ghigh &amp;="" rchannel="" &gt;="" rlow="" &amp;="" rchannel="" &lt;="" rhigh="" <="" p="">

I hope this is want you want.

aniket1 gravatar imageaniket1 ( 2018-01-16 04:39:41 -0600 )edit

suppose we have a formula with this we deduce that we come to a solution, I know that for image processing are based on formulas, but I do not know what is the formula that applies to what I already do

quiques gravatar imagequiques ( 2018-01-16 13:12:19 -0600 )edit

What mathematical formula is used in image processing?

quiques gravatar imagequiques ( 2018-01-19 19:29:39 -0600 )edit

tanks........

quiques gravatar imagequiques ( 2018-01-23 11:35:30 -0600 )edit