第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

OpenCV Point(x,y)表示(列,行)或(行,列)

OpenCV Point(x,y)表示(列,行)或(行,列)

我在Matrix src中有300 * 200的圖像。我正在對(duì)圖像進(jìn)行以下操作。for(int i=0;i<src.rows;i++){for(int j=0;j<src.cols;j++){line( src, Point(i,j),Point(i,j), Scalar( 255, 0, 0 ),  1,8 );}]imshow("A",src);waitKey(0);我期待它以白色覆蓋整個(gè)圖像,但圖像的下半部分仍然是空的。如果我這樣做的話  for(int i=0;i<src.rows;i++){    for(int j=0;j<src.cols;j++){    src.at<uchar>(i,j)=255;    }    ]    imshow("A",src);    waitKey(0);整個(gè)圖像覆蓋白色。所以,這意味著src.at(i,j)使用(i,j)作為(行,列),但Point(x,y)使用(x,y)作為(列,行)
查看完整描述

3 回答

?
ABOUTYOU

TA貢獻(xiàn)1812條經(jīng)驗(yàn) 獲得超5個(gè)贊

這是一個(gè)用于區(qū)分python的[row,columns]和OpenCV的[x,y]的可視示例。


import numpy as np

import matplotlib.pyplot as plt

import cv2


img = np.zeros((5,5))  # initialize empty image as numpy array

img[0,2] = 1  # assign 1 to the pixel of row 0 and column 2


M = cv2.moments(img)  # calculate moments of binary image

cX = int(M["m10"] / M["m00"])  # calculate x coordinate of centroid

cY = int(M["m01"] / M["m00"])  # calculate y coordinate of centroid


img2 = np.zeros((5,5))  # initialize another empty image

img2[cX,cY] = 1  # assign 1 to the pixel with x = cX and y = cY


img3 = np.zeros((5,5))  # initialize another empty image

img3[cY,cX] = 1  # inver x and y


plt.figure()

plt.subplot(131), plt.imshow(img, cmap = "gray"), plt.title("With [rows,cols]")

plt.subplot(132), plt.imshow(img2, cmap = "gray"), plt.title("With [x,y]")

plt.subplot(133), plt.imshow(img3, cmap= "gray"), plt.title("With [y,x]")


查看完整回答
反對(duì) 回復(fù) 2019-09-20
  • 3 回答
  • 0 關(guān)注
  • 3544 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)