Q:

How to determine range of HSV values of the image?

Is there any method to find range of hsv values of image (object) in rectangle inside big image? I mean, there is fixed size rectangle on my image(frame from camera) and i want to find range of hsv values of object which is inside this rectangle. Object is changeable. If i put red ball inside rectangle it should find range of red ball's hsv values, if i put my hand inside rectangle it should find range of my skin's hsv values. Is there any way to do this? 
Edit:
I get part of image with ROI, and convert it to hsv format. But problem is behind red ball, I get wide variety of colours. So which range will I choose from this image?
Example: my frame:

Now I want to find best range of hsv values of image in rectangle box for tracking it. (Now it should be green and ranges should be h:53-90 s:74-147 v: 160-255)
If i can find this values, by using inRange method, i can convert it to binary image for tracking. Like this:

A:

You can simply specify a ROI for that region and convert it into HSV.
For eg (below is pseudo-code in Python-OpenCV)
# define ROI of RGB image 'img'
roi = img[r1:r2, c1:c2]

# convert it into HSV
hsv = cv2.cvtColor(roi,cv2.COLOR_BGR2HSV)

Now it gives you the hsv values of the region.
But one or two difficulties there:

Your object may comprise some part of the ROI. There may be some background region also inside your ROI. ie if your object is red and background is blue, your ROI will contain two different values, one for RED and other for BLUE. Which one will your program select?
But colors won't be constant like RED or BLUE. You get wide variety of colours. Below is a plot of different colours for a ROI with green object.

But it has values from yellow to slight blue with green as major. 
So you will have to select color with maximum probability, may be from checking its histogram. 
Check this SOF for more details : https://stackoverflow.com/questions/13111504/selecting-best-range-of-values-from-histogram-curve

