OpenCV Blue Color Ranges Detection

I am extracting the blue color using OpenCV inRange(), and the code is written in C++.

My problem is my range doesn't cover the varying shades of blue, for example 1st Image blue color was extracted perfectly as shown 1st image resultOn the other hand, 2nd Image was not extracted as shown 2nd image result

The masking code

+ (UIImage *)detectFourCorners:(UIImage *)image{

cv::Mat mat;
UIImageToMat(image, mat);

// Convert input image to into BGR
cv::Mat bgr_image;
cv::cvtColor(mat, bgr_image, cv::COLOR_RGB2BGR);

// Convert input image to HSV
cv::Mat hsv_image;
cv::cvtColor(bgr_image, hsv_image, cv::COLOR_BGR2HSV);

cv::Mat mask;

// original
cv::inRange( hsv_image, cv::Scalar(100,150,0), cv::Scalar(140,255,255), mask);

cv::Mat result_blue;
cv::bitwise_and(mat,mat,result_blue,mask);

return MatToUIImage(result_blue); }

I believe I'm not covering all the needed ranges of blue, but I don't know how to get my own ranges. If anyone could help, it would be appreciated !

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum