更新 'Home'
90
Home.md
90
Home.md
@ -1,30 +1,86 @@
|
|||||||
1、需求分析
|
1、需求分析
|
||||||
|
|
||||||
FSA2 采集数据时,显示当前云量,以便用户判断当前野外光照条件是否适合采集数据;
|
任工想简化设置维特惯导的参数的过程;
|
||||||
|
|
||||||
2、功能概述
|
2、功能概述
|
||||||
|
|
||||||
通过rgb图像进行云点识别 + 云量计算 + 输出云分布二值图;
|
通过此库提供的功能,能够方便的设置维特惯导的所有参数;
|
||||||
|
|
||||||
3、api说明
|
3、api说明
|
||||||
|
|
||||||
Cloudage(int radius);//构造函数传入云量计算的有效半径
|
见代码中
|
||||||
void setRadius(int radius);//此函数可以修改云量计算的有效半径
|
|
||||||
|
|
||||||
QImage readImage(QString imagePath);//此函数可以从磁盘读入图片
|
4、UML图
|
||||||
QImage createGrayscaleImage(int width, int height);////此函数根据参数创建一个灰度图像
|
|
||||||
|
|
||||||
void getPosOfCenterpixel(int width, int height, int &widthCenter, int &heightCenter);//计算图片的中心点
|
无法上传图片;
|
||||||
bool isValidPos(int x1, int y1, int x2, int y2);//判断像元点(x,y)是否在有效半径内
|
|
||||||
|
|
||||||
float getcloudage1(QImage image, bool saveBinaryImg = false);//通过算法1进行云量计算
|
5、使用
|
||||||
float getcloudage2(QImage image, bool saveBinaryImg = false);//通过算法2进行云量计算
|
|
||||||
4、使用举例
|
|
||||||
|
|
||||||
QString imgPath = "D:\\PycharmProjects\\cloudage\\photo\\photo12.jpg";
|
5.1 使用方法
|
||||||
|
|
||||||
Cloudage* tmp = new Cloudage(443);
|
(1)首先继承SerialPortBase类,实现串口收发功能类B;
|
||||||
QImage img = tmp->readImage(imgPath);
|
(2)实例化WitmotionDll时,需要传入串口类B;
|
||||||
|
(3)设置参数时,直接调用参数对应的函数即可;
|
||||||
|
|
||||||
float cloud1 = tmp->getcloudage1(img);
|
5.2 使用示例代码
|
||||||
float cloud2 = tmp->getcloudage2(img);
|
|
||||||
5、输出结果:
|
#include <QCoreApplication>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
|
#include "witmotiondll.h"
|
||||||
|
#include "qtserialport.h"
|
||||||
|
#include "windowsserialport.h"
|
||||||
|
|
||||||
|
void delay_tc(uint32_t millisecond)
|
||||||
|
{
|
||||||
|
QThread::sleep(millisecond/1000);
|
||||||
|
std::cout<<"This is delay_tc!!!!!!!!!!"<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void printf_tc(const char* text)
|
||||||
|
{
|
||||||
|
printf(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QCoreApplication a(argc, argv);
|
||||||
|
|
||||||
|
SerialPortBase * serialPort = new QtSerialport();
|
||||||
|
// SerialPortBase * serialPort = new windowsSerialPort();
|
||||||
|
|
||||||
|
serialPort->OpenSerialPort("COM15", 9600);
|
||||||
|
|
||||||
|
WitmotionDll * tmp = new WitmotionDll(serialPort);
|
||||||
|
tmp->delayMsRegister(delay_tc);
|
||||||
|
tmp->printfRegister(printf_tc);
|
||||||
|
tmp->setDelayTimeMs(1000);
|
||||||
|
|
||||||
|
tmp->installationOrientation(ORIENT_VERTICAL);
|
||||||
|
// tmp->algorithm(ALGROITHM9);
|
||||||
|
// tmp->setTimeZone(UTC_P12);
|
||||||
|
// tmp->SetBaudrate(WIT_BAUD_115200);
|
||||||
|
// tmp->SetReturnRate(RRATE_20HZ);
|
||||||
|
|
||||||
|
// tmp->SetDeviceAddress(124);
|
||||||
|
|
||||||
|
// tmp->setD0Model(DOL);
|
||||||
|
// tmp->setD0HighLevelPulseWidth(20);
|
||||||
|
// tmp->setD0Period(5);
|
||||||
|
|
||||||
|
// RETURN_CONTENT_STRUCT content;
|
||||||
|
// content.time = true;
|
||||||
|
// content.angular_velocity = true;
|
||||||
|
// content.euler_angle = true;
|
||||||
|
// content.ground_velocity = true;
|
||||||
|
// content.quaternion = true;
|
||||||
|
// tmp->setContent(content);
|
||||||
|
|
||||||
|
|
||||||
|
// tmp->recordData();
|
||||||
|
|
||||||
|
serialPort->CloseSerialPort();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
|
6、输出结果:
|
Reference in New Issue
Block a user