Ask Your Question

Extracting only blue from given image

asked 2016-02-15 11:18:15 -0500

Dr Dre gravatar image

Hi Guys

I Have an input image as

image description

I Have used the following code to brighten blue

import cv2
import numpy as np

Image = cv2.imread('blue.jpg')

Threshold = np.zeros(Image.shape, np.uint8)
cv2.threshold(Image, 121, 255, cv2.THRESH_BINARY, Threshold)
cv2.imshow("WindowName", Threshold )


The output of this code is

image description

I want to extract only the blue portion of this image and eliminate the remaining ..

The output should be anything like these images

image description

image description

image description

I am using python2.7 with cv2

edit retag flag offensive close merge delete




In the code that u have provided

lower_blue = np.array([110,50,50])
upper_blue = np.array([130,255,255])

is this range bgr value of hsv image ??? or hsv value

Dr Dre gravatar imageDr Dre ( 2016-02-15 18:55:57 -0500 )edit

it is obvious

# define range of blue color in HSV
lower_blue = np.array([110,50,50])
upper_blue = np.array([130,255,255])
sturkmen gravatar imagesturkmen ( 2016-02-16 03:44:32 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-02-26 08:31:46 -0500

Dr Dre gravatar image

This link helped me to find the solution

edit flag offensive delete link more


Thank U @sturkmen

Dr Dre gravatar imageDr Dre ( 2016-02-26 08:34:33 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-02-15 11:18:15 -0500

Seen: 116 times

Last updated: Feb 26 '16