MIPI RAW图像数据与RAW图像数据

版权声明:本文为博主原创文章,未经博主允许不得转载或用于商业用途。 https://blog.csdn.net/luzhanbo207/article/details/80244912

在ISP图像处理中经常需要面对MIPI RAW数据和RAW数据,这里简单说明一下二者的差别。
传感器采集的RAW数据通常为10bit,存储RAW数据需要两个Byte,而其中有4个bit位是空着的,这样就有存储空间浪费。MIPI RAW数据充分利用了这个特性,采用5个Byte,共40bit存储4个RAW数据。这里以大端存储方式,给出这样存储的示意图。如下图所示:
这里写图片描述

从MIPI RAW数据恢复RAW数据的方法:

//b1,b2,b3,b4,b5分别为连续读出的五个uint8类型的数据,p1,p2,p3,p4为四个像素点的像素值,那么
p1 = (b1 << 2) + ((b5     ) & 0x3);
P2 = (b2 << 2) + ((b5 >> 2) & 0x3);
P3 = (b3 << 2) + ((b5 >> 4) & 0x3);
P4 = (b4 << 2) + ((b5 >> 6) & 0x3);
展开阅读全文

读取raw图像数据

01-06

一个读取raw格式图像数据并显示的函数,但是显示不正确,哪位高手给看看问题出在哪,或者是哪里可能有问题。谢谢rnrnrn/*************************************************************************rn*rn* Function: ReadRAWFile (CFile&)rn* rn* Purpose: Reads in the specified RAW file into a global chunk ofrn* memory.rn* rn* Returns: A handle to a dib (hDIB) if successful.rn* NULL if an error occurs.rn* rn* Comments: BITMAPFILEHEADER is stripped off of the DIB.rn* Everything from the end of the BITMAPFILEHEADER structure rn* on is returned in the global memory handle.rn* rn**************************************************************************/rnHDIB ReadRAWFile(CFile& file)rnrn double min,max;rn int width,height;rnrn CRawdlg dlg;rn if (dlg.DoModal() != IDOK) return FALSE;rn width=dlg.m_width;rn height=dlg.m_height;rnrnrn //Allocate memory for the imagern DWORD dwImageSize = width*height*12;// 12=DIBChannelsrn BYTE* pImageData = new BYTE[dwImageSize];rnrn file.Read(pImageData,dwImageSize);rnrnrn // Setup the DIB with the correct detailsrn BITMAPINFO bmi;rn BITMAPINFOHEADER& bih = bmi.bmiHeader;rn ZeroMemory(&bih, sizeof(BITMAPINFOHEADER));rn bih.biSize = sizeof(BITMAPINFOHEADER);rn bih.biWidth = width;rn bih.biHeight= height;rn bih.biCompression = BI_RGB;rn bih.biPlanes = 1;rn bih.biBitCount = 24;rnrn // Allocate memory for DIBrn DWORD dwBmpBitsSize = WIDTHBYTES(width*24)*height;rn HDIB hDIB = (HDIB) ::GlobalAlloc(GHND, bih.biSize + dwBmpBitsSize);rn if (hDIB == 0)rn rn TRACE(_T("Could not allocate memory for the DIB while loading from file!\n"));rn delete [] pImageData;rn return NULL;rn rnrn LPSTR pDIB = (LPSTR) ::GlobalLock((HGLOBAL) hDIB);rn if (pDIB == 0)rn rn TRACE(_T("Could not lock memory for the DIB while loading from file!\n"));rn delete [] pImageData;rn return NULL;rn rnrn //Copy over the header to the DIBrn CopyMemory(pDIB, &bmi.bmiHeader, bih.biSize);rnrn //Copy the DIB bits from the user buffer into the DIBrn BYTE* pBmp = (BYTE*) (pDIB + bih.biSize);rn for (int j=0; j 论坛

没有更多推荐了,返回首页