Most prominent color in select area -- color detection


I am currently working on a project where I want to use my webcam and the colors detected to make a display using an Arduino. I’m at the point where I want to figure out color detection.
My initial thought process is to select a select group of pixels using a for loop, as written out below. I intend to detect the most prominent color in the cropped section and then transfer that information into an array from which I will later pull the color.

import cv2
import numpy as np

webcam = cv2.VideoCapture(0)   
# web cam is 640x480, so I'm trying to get 480x480
sizeCrop = 48

# Dividing the original video in 4 parts by slicing the frame array
while True :
    photo =[1]           # Storing the frame in a variable photo
    photo = cv2.flip(photo,1)       # Fliping the photo for mirror view

    hsvFrame = cv2.cvtColor(photo, cv2.COLOR_BGR2HSV)
    cv2.imshow('frame', hsvFrame)

    for y in range (0, 481, 48) :
        for x in range(80, 561, 48):
            photo =[1]           
            photo = cv2.flip(photo,1)
            hsvFrame = cv2.cvtColor(photo, cv2.COLOR_BGR2HSV)
            cv2.imshow('frame', hsvFrame)
            crop = hsvFrame[y:y+sizeCrop, x:x+sizeCrop]
            cv2.imshow("current crop", crop)     # It will show crop part in a window  

            if cv2.waitKey(50) == 13 :      # Specifying (Enter) button to break the loop

    if cv2.waitKey(50) == 13 :      # Specifying (Enter) button to break the loop

cv2.destroyAllWindows()            # To destroy all windows 

I’m not the best at OpenCV-Python, and I sort of just jumped into this project. I would love to hear if anyone has any ideas on how I could approach this part of the project more simplistically, as my method of cropping the live webcam is not working.
Currently, the issue is the loop doesn’t continue. After it runs through all the pixels once the windows close.

As a beginner, I would also really appreciate any resources anyone could relay if you think they may help my current problems.

Thank you in advanced!

I confirm you seem a beginner
Try first video tutorial

What do you mean by color detection?

Thank you for the video!
I’m looking to get the HSV or RGB values of the sections I was talking about and put those values into an array

use cvtColor to convert image
Tutorial is here