[英]What does this symbol mean in IntelliJ? (red circle on bottom-left corner of file name, with 'J' in it)
[英]How to start a count in java from bottom-left corner?
我知道在java中,左上角被認為是(0,0)坐標。 我正在嘗試計算文件的像素。 文件像素(0,0)坐標從左下角開始。 屏幕總面積為1121x881。 我需要按順序計算像素,以便數據與坐標匹配。 我想要的1121x881區域是543x451。 任何人都可以幫我這樣做嗎?
編輯:似乎所需的效果是從左下角開始的543,451?
在這種情況下:
w= //your desired width
h= //your desired height
for(int x=543; x<w+543; x++){
for(y=(pic.height-451)+h; y<pic.height-h;y++){
//count;
}
}
此代碼從左下角開始,向上移動451,超過543,然后按照您的指定捕獲寬度和高度的部分。
而不是標准
for(int x=0; x<pic.width; x++){
for(y=0; y<pic.height;y++){
//count;
}
}
為什么不試試
for(int x=0; x<pic.width; x++){
for(y=pic.height; y>0;y--){
//count;
}
}
這將從左下角開始計數並向上工作,然后向左工作。 通過更改循環的限制,您可以定義所需的區域。
如果您想要一個543x451的區域,其左下角與您原來的圖像相同:
for(int x=0; x<543; x++){
for(y=pic.height; y>451;y--){
//count;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.