我正在使用带有Qt后端的OpenCV(3.3),因为我想使用集成的缩放功能。现在我想实现缩放图像适合整个窗口。此时,放大的图像仅显示在初始图像显示不是最佳的区域中,至少在我使用垂直图像时。
最好的方法是什么?
修改 示例图片:
与标准Xubuntu图像查看器的行为相比。这是我想用OpenCV实现的行为。缩放的图像填满整个窗口。
import android.widget.CompoundButton;
public class RadioGroupCheckListener implements CompoundButton.OnCheckedChangeListener {
private CompoundButton[] allies;
/**
* public generator - indicate allies
* @param allies all other buttons in the same RadioGroup
*/
public RadioGroupCheckListener(CompoundButton... allies){
this.allies = allies;
}
/**
* listener for a button to turn other allies unchecked when it turn checked
* @param buttonView change check occur with this button
* @param isChecked result of changing
*/
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
for (CompoundButton aly : allies) {
aly.setChecked(false);
}
}
}
/**
* inner private function to remove one element from Buttons array
* @param buttons all the buttons in RadioGroup
* @param me the index that we want to remove from array
* @return an array of CompoundButtons except the index of me
*/
private static CompoundButton[] exceptMe(CompoundButton[] buttons, int me){
CompoundButton[] result = new CompoundButton[buttons.length-1];
for(int i=0,j=0;i<buttons.length;i++){
if(i==me){
continue;
}
result[j]=buttons[i];
j++;
}
return result;
}
/**
* static function to create a RadioGroup
* if a button turn to checked state all other buttons is group turn unchecked
* @param buttons the buttons that we want to act like RadioGroup
*/
public static void makeGroup(CompoundButton... buttons){
for(int i=0;i<buttons.length;i++){
buttons[i].setOnCheckedChangeListener(new RadioGroupCheckListener(exceptMe(buttons, i)));
}
}
}