>网站服务器>服务器租用>香港站群软件服务器IplImage与Qi.. 免费发布服务器租用信息
广告
热门浏览

香港站群软件服务器IplImage与Qimage之间转换

更新时间:2019-01-09 10:29:39 信息编号:252684549
800≥ 1台
  • 800.00 元

  • intel

  • 机架式

  • 站群服务器租用,高防服务器租用,香港服务器租用,芭奇软件站群

分享

详情介绍

香港站群软件服务器IplImage与Qimage之间转换

服务项目
站群服务器租用,香港服务器租用,高防服务器租用,芭奇软件站群
面向地区
全国
品牌
intel
服务器类型
机架式
CPU类型
I5
内存类型
DDR3
CPU核心
四核
OEM
标配CPU个数
1个
标配硬盘转速
12000转
磁盘阵列
RAID5
货源类别
现货
结构
1U
硬盘容量
500GB
支持内存容量
4GB
质保
一年
大CPU个数
1个
类型
其它
香港站群软件服务器IplImage与Qimage之间转换

站群服务器租用 请联系:锐辉网络敏敏 :...........................................2853898501

//IplImageToQImage.h

#ifndef QTIPL_H
#define QTIPL_H

#include <iostream>
#include <cstring>
#include <qimage.h>
#include "cv.h"
#include <QVector>

using std::string;
using std::iostream;
//const int QImage_IgnoreEndian = 2;

void IplImageToQImage(const IplImage * iplImage,QImage *qimage,uchar *qImageBuffer,double mini=0.0, double maxi=0.0);
void QImageToIplImage(const QImage * qImage,IplImage *charIplImageBuffer);

#endif
/////////////////////////
IplImageToQImage.cpp
//-------------------------------------------------------------------------
//C++
/*IplImageToQImage.cpp
*
* Creation : 23th april 2003
* last modified : 2017.07.12
* Author(s) : chen
*
* Contents: -Interface between qt Images and openCV Images

//#include <stdint>
#include "IplImageToQImage.h"

inline int align(int size, int align)
{
return (size + align - 1) & -align;
}

void QImageToIplImage(const QImage * qImage,IplImage *charIplImageBuffer)
{
int width = qImage->width();
int height = qImage->height();

for (int y = 0; y < height; ++y)
{
unsigned char* charTemp=(unsigned char*)(charIplImageBuffer->imageData+y*charIplImageBuffer->widthStep);
for (int x = 0; x < width; ++x)
{
charTemp[3*x+0] = (unsigned char) qBlue(qImage->pixel(x, y));//取B通道数据
charTemp[3*x+1] = (unsigned char) qGreen(qImage->pixel(x, y));//取G通道数据
charTemp[3*x+2] = (unsigned char) qRed(qImage->pixel(x, y));//取R通道数据

void IplImageToQImage(const IplImage * iplImage,QImage *qimage,uchar *qImageBuffer,double mini, double maxi)
{
// uchar *qImageBuffer = NULL;

int width = iplImage->width;

/* Note here that OpenCV image is stored so that each lined is
32-bits aligned thus
* explaining the necessity to "skip" the few last bytes of each
line of OpenCV image buffer.
*/
int widthStep = iplImage->widthStep;
int height = iplImage->height;

switch (iplImage->depth)
{
case IPL_DEPTH_8U:
if (iplImage->nChannels == 1)
{
/* OpenCV image is stored with one byte grey pixel. We convert it
to an 8 bit depth QImage.
*/

uchar *QImagePtr = qImageBuffer;
const uchar *iplImagePtr = (const uchar *) iplImage->imageData;

for (int y = 0; y < height; y++)
{
// Copy line by line
memcpy(QImagePtr, iplImagePtr, width);
QImagePtr += width;
iplImagePtr += widthStep;

else if (iplImage->nChannels == 3)
{
/* OpenCV image is stored with 3 byte color pixels (3 channels).
We convert it to a 32 bit depth QImage.
*/
uchar *QImagePtr = qImageBuffer;
const uchar *iplImagePtr = (const uchar *) iplImage->imageData;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
// We cannot help but copy manually.
QImagePtr[0] = iplImagePtr[0];
QImagePtr[1] = iplImagePtr[1];
QImagePtr[2] = iplImagePtr[2];
QImagePtr[3] = 0;
QImagePtr += 4;
iplImagePtr += 3;
}
iplImagePtr += widthStep-3*width;

else
{
qDebug("IplImageToQImage: image format is not supported : depth=8U and %d channels\n", iplImage->nChannels);
}
break;
case IPL_DEPTH_16U:
if (iplImage->nChannels == 1)
{
/* OpenCV image is stored with 2 bytes grey pixel. We convert it
to an 8 bit depth QImage.
*/
uchar *QImagePtr = qImageBuffer;
const unsigned int *iplImagePtr = (const unsigned int *)iplImage->imageData;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
// We take only the highest part of the 16 bit value. It is
//similar to dividing by 256.
*QImagePtr++ = ((*iplImagePtr++) >> 8);
}
iplImagePtr += widthStep/sizeof(unsigned int)-width;
else
{
qDebug("IplImageToQImage: image format is not supported : depth=16U and %d channels\n", iplImage->nChannels);

}
break;
case IPL_DEPTH_32F:
if (iplImage->nChannels == 1)
{
/* OpenCV image is stored with float (4 bytes) grey pixel. We
convert it to an 8 bit depth QImage.
*/
uchar *QImagePtr = qImageBuffer;
const float *iplImagePtr = (const float *) iplImage->imageData;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
uchar p;
float pf = 255 * ((*iplImagePtr++) - mini) / (maxi - mini);
if (pf < 0) p = 0;
else if (pf > 255) p = 255;
else p = (uchar) pf;

*QImagePtr++ = p;
}
iplImagePtr += widthStep/sizeof(float)-width;

else
{
qDebug("IplImageToQImage: image format is not supported : depth=32F and %d channels\n", iplImage->nChannels);
}
break;
case IPL_DEPTH_64F:
if (iplImage->nChannels == 1)
{
/* OpenCV image is stored with double (8 bytes) grey pixel. We
convert it to an 8 bit depth QImage.
*/
uchar *QImagePtr = qImageBuffer;
const double *iplImagePtr = (const double *) iplImage->imageData;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
uchar p;
double pf = 255 * ((*iplImagePtr++) - mini) / (maxi - mini);
if (pf < 0) p = 0;
else if (pf > 255) p = 255;
else p = (uchar) pf;

*QImagePtr++ = p;
}
iplImagePtr += widthStep/sizeof(double)-width;

else
qDebug("IplImageToQImage: image format is not supported : depth=64F and %d channels\n", iplImage->nChannels);
}
break;
default:
qDebug("IplImageToQImage: image format is not supported : depth=%d and %d channels\n", iplImage->depth, iplImage->nChannels);
}//end of switch

QImage *qImage;
qImage=qimage;
QVector<QRgb> vcolorTable;
if (iplImage->nChannels == 1)
{
// We should check who is going to destroy this allocation.
QRgb *colorTable = new QRgb[256];
for (int i = 0; i < 256; i++)
colorTable[i] = qRgb(i, i, i);
vcolorTable[i] = colorTable[i];
delete colorTable;
qImage->setColorTable(vcolorTable);
else

东莞市锐辉网络有限公司 7年

  • 高防服务器,服务器托管
  • 广东东莞高盛科技园北区C座309

———— 认证资质 ————

没有个人认证
企业认证已通过
天眼查未核实
手机认证已通过
没有微信认证

最近来访记录

  • 广东东莞网友一个月前在百度搜索“2853898501”访问了本页

相关推荐产品

留言板

  • 站群服务器租用香港服务器租用高防服务器租用芭奇软件站群
  • 价格商品详情商品参数其它
  • 提交留言即代表同意更多商家联系我
东莞市锐辉网络有限公司为你提供的“香港站群软件服务器IplImage与Qimage之间转换”详细介绍,包括站群服务器租用价格、型号、图片、厂家等信息。如有需要,请拨打电话:18316411879。不是你想要的产品?点击发布采购需求,让供应商主动联系你。
“香港站群软件服务器IplImage与Qimage之间转换”信息由发布人自行提供,其真实性、合法性由发布人负责。交易汇款需谨慎,请注意调查核实。
留言询价
×