How to calculate an ellipse area in pixel?

104 Views Asked by At

First,I converted the rgb image into hsv

  res = RGB_to_HSV(img)

Then, I used locator (4) to define four (x,y) coordinate

  x<-c(0.3546019, 0.7089434, 0.5494897, 0.5534268)
  y<-c(0.5302427, 0.5158414, 0.5907282, 0.4351941)
  dat<-as.matrix(cbind(x,y))


 

Here's some information related to the centre and

'ellipsoid' in 2 dimensions:

center = ( 0.53250 0.51396 ); squared ave.radius d^2 =  2 

and shape matrix =

        x           y
   x  0.01592764 -0.00089633

   y -0.00089633  0.00310081

   hence, area  =  0.043796 

  They gives the minimal volume area

 the major axis= 0.19

 the minor axis = 0.07

I have tried the following:

 result <- as.data.frame(dat) %>%
 summarise(pixels = n())
  result

but this gives the number of pixel of x and y coordinates

Any clue how to calculate the area in pixel?

0

There are 0 best solutions below