获取rawimage的像素点函数_ImageMagick提取图像原始数据(ImageData/RawData)

1 //ImageMagick_use_test.cpp : Defines the entry point for the console application.2 //3

4 #include "stdafx.h"

5 #include "wand\MagickWand.h"

6 #include "magick\MagickCore.h"

7 #include "stdio.h"

8 #include "stdlib.h"

9 #include "conio.h"

10 #include "malloc.h"

11

12 #define OUT

13

14 void ThrowWandException(MagickWand*wand)15 {16 char *description;17

18 ExceptionType severity;19 char err_msg[125];20

21 description=MagickGetException(wand,&severity);22 sprintf(err_msg,"%s\nError_Type is %d\n",description,severity);23 //description=(char *) MagickRelinquishMemory(description);

24

25 printf(err_msg);26 }27

28 char* __stdcall GetGrayPixelFormat_16bit( const char* fileName, int width, int height, OUT char*pDestImage );29

30 bool __stdcall GetRGBPixelFormat_16bit( const char* fileName, int width, int height, OUT char* pRed, OUT char* pGreen, OUT char*pBlue);31

32 int _tmain(int argc, _TCHAR*argv[])33 {34

35 char *pDestImage =NULL;36 char *pRed =NULL;37 char *pGreen =NULL;38 char *pBlue =NULL;39 //Allocate 1024*5 Buffer in bytes

40 pDestImage = (char*)malloc(1920*1200*2);41 pRed = (char*)malloc(1920*1200*2);42 pGreen = (char*)malloc(1920*1200*2);43 pBlue = (char*)malloc(1920*1200*2);44

45 memset(pDestImage,0,1920*1200*2);46 memset(pRed, 0, 1920*1200*2);47 memset(pGreen, 0, 1920*1200*2);48 memset(pBlue, 0, 1920*1200*2);49

50 pDestImage = GetGrayPixelFormat_16bit( "C:\\Users\\Yajun Dou\\Desktop\\12.jpg", 1920, 1200, pDestImage);51

52 if(pDestImage ==NULL)53 {54 printf("GetGrayPixelFormat_16bit Failed!\n");55 }56

57 if(GetRGBPixelFormat_16bit("C:\\Users\\Yajun Dou\\Deskto

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值