面阵相机以及相机选型公式

面阵相机以及相机选型公式

#include 
#include 

using namespace std;

int main()
{
	cout << "工业相机选型公式" << endl;
	/**芯片*/
	string chip;
	cout << "选择CCD芯片或者CMOS芯片:";
	cin >> chip;

	float Long, Wide;
	cout << "请输入视场的长和宽:" << endl;
	cout << "长(mm):";
	cin >> Long;
	cout << "宽(mm):";
	cin >> Wide;
	Long += 20;
	Wide += 20;

	/**检测精度*/
	float accuracy;
	cout << "请输入检测精度(mm/pixel):" ;
	cin >> accuracy;

	/*工作距离**/
	float WD;
	cout << "请输入工作距离(mm):" ;
	cin >> WD;

	/**检测速度*/
	float speed;
	cout << "请输入检测速度(个/分钟):";
	cin >> speed;

	/* 水平分辨率 垂直分辨率**/
	float resolution_wide, resolution_long;
	resolution_wide = Wide / accuracy;
	resolution_long = Long / accuracy;

	/**帧率*/
	float fps;
	fps = speed / 60;

	cout << endl;
	cout << "您选择的是" << chip << "芯片相机,"
		 << "水平分辨率为" << resolution_wide << "像素,"
		 << "垂直分辨率为" << resolution_long << "像素,"
		 << "帧率为" << fps << "帧。" << endl;
	
	cout << endl;
	cout << "工业相机选型公式" << endl;
	/**芯片尺寸*/
	float chip_size, chip_long, chip_wide;
	cout << "请输入相机的芯片尺寸( '):";
	cin >> chip_size;
	chip_long = chip_size * 16 * 0.8;
	chip_wide = chip_size * 16 * 0.6;

	/**光学放大倍率*/
	float magnification;
	magnification = chip_long / Long;
	if (magnification < chip_wide / Wide)
	{
		magnification = chip_wide / Wide;
	}

	/**焦距*/
	float force;
	force = WD / (1 + 1.0 / magnification);

	cout << endl;
	cout << "工业相机的焦距为" << force << "mm" << endl;
	return 0;
}

你可能感兴趣的:(面阵相机以及相机选型公式)