1
내가 바라는 것은 쿼드 프레임 피드에 4 개의 비디오 피드, RGB, B, G, R 채널을 함께 쌓을 수 있도록 만드는 것입니다. 여기에 내 코드가 있습니다. "모든 입력 배열의 치수가 같아야합니다.이 작업을 수행 할 수있는 방법이 있는지 알고 싶습니까? GRAY를 삽입하면 RGB가 전체 결과를 볼 수 있습니다. 회색 프레임이 어디 RGB 프레임 이외 걸려 라하는 것은해야한다스택 cv2 RGB 채널과 단일 채널의 프레임 함께
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
while(True):
ret, frame = cap.read()
# Resizing down the image to fit in the screen.
b,g,r = cv2.split(frame)
RGB = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
GRAY = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# creating another frame.
channels = cv2.split(frame)
frame_merge = cv2.merge(channels)
# horizintally concatenating the two frames.
final_frame = cv2.hconcat((frame, frame_merge))
final_frame2 = cv2.hconcat((frame, frame_merge))
final = cv2.vconcat((final_frame, final_frame2))
frame1 = np.hstack((RGB,b))
frame2 = np.hstack((g,r))
final = np.vstack((frame1,frame2))
cv2.imshow('frame', final)
k = cv2.waitKey(30) & 0xff
if k == 27:
break
cap.release()
cv2.destroyAllWindows()
. cvtColor (frame, cv2.COLOR_BGR2GRAY)를 사용하면 내가 수행 할 결과를 볼 수 있습니다. 카메라 앞에 빨간색 물체를 올려 놓으면 빨간색 채널이 빨간색을 강조하고 다른 색상은 계속 강조 표시됩니다. 첫 번째 회색 프레임 대신에 나는 그것이 규칙적인 컬러 프레임이되기를 원합니다. –
@MichaelHenderson 내가 올바르게 이해했는지 모르겠다. 그건 내 솔루션이 편집하기 전에 달성 하려던 것이 아니란 말인가요? – BPL
@MichaelHenderson 새로운 솔루션을 추가했습니다. 원하는 솔루션인지 알려주십시오. 그렇지 않은 경우 조금 더 설명하십시오. – BPL