作者iphone5566s (哀鳳最終款)
看板AndroidDev
標題[問題] 圖片的中心點座標
時間Fri Dec 18 15:20:45 2015
各位先進好~
我以此方式來進行拍攝獲得相片
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 1);
接著來找出照片的中心點
protected void onActivityResult(int requestCode, int resultCode, Intent
intent) {
super.onActivityResult(requestCode, resultCode, intent);
Bitmap picture;
picture = (Bitmap) intent.getExtras().get("data");
cpic = picture.copy(Bitmap.Config.ARGB_8888, true);
int[][] imRed =new int[picture.getWidth()][picture.getHeight()];
int[][] imGreen =new int[picture.getWidth()][picture.getHeight()];
int[][] imBlue =new int[picture.getWidth()][picture.getHeight()];
br=imRed[picture.getWidth()/2][picture.getHeight()/2];
bg=imRed[picture.getWidth()/2][picture.getHeight()/2];
bb=imRed[picture.getWidth()/2][picture.getHeight()/2];
這時候我得到的RGB卻不是照片的中間
而是在中間偏左下的位置
請問我那裡想錯了嗎?
謝謝!!!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.136.95.238
※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1450423248.A.C31.html
※ 編輯: iphone5566s (114.136.95.238), 12/18/2015 17:34:20
推 MrJerome: 該圖片寬跟高分別是多少pixel? 12/18 21:08
→ MrJerome: 以及x y cellsize分別是多少? 12/18 21:09
推 howdye: 拍出來的圖是ARGB_8888嗎? 會不會只有RGB 12/18 22:09
→ iphone5566s: 解決了,應該只是設備不好造成畫面延遲罷了.. 12/21 10:02
→ iphone5566s: 謝謝各位!! 12/21 10:02