ImageMagickのRGB値の配列があり、opencvでIplImage構造体を作成したいと考えています。私は、ImageMagickイメージをhddに書き込んだり再読み込みしなくても、IplImageの内容をrgb配列の値に設定する方法を知りました。OpenCv Image from RGB Array
1
A
答えて
1
ImageMagick ImageオブジェクトをIplImageに変換します。バッファに書き込んだ後、そのバッファからIplImageを作成するだけです。コードはこちらから(http://www.imagemagick.org/discourse-server/viewtopic.php?f=23 &トン= 18183):
void Magick2Ipl(Image magicImage, IplImage* cvImage)
{
int width= magicImage.size().width();
int height = magicImage.size().height();
byte* blob= new byte[cvImage->imageSize];
magicImage.write(0,0, width, height, "BGRA", MagickCore::CharPixel, blob);
memcpy(cvImage->imageData, blob, cvImage->imageSize);
delete [] blob;
}
敬具、 ダニエル
0
あなたは、また、この方法でそれを行うことができます
Image image("Image_Path"); int width = image.size().width(); int height = image.size().height(); IplImage* mat = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 3); image.write(0, 0, width, height, "BGR", Magick::CharPixel, (char*)mat->imageData); cvShowImage("image", mat);
関連する問題
- 1. Javascript Image from Array
- 2. C++ - RGB 1-D ArrayをOpenCV Matに変換する
- 3. Java Script Get array from array fromテキストボックス
- 4. Image from SD storage from ByteArray
- 5. android opencv rgb to hsv
- 6. 'Array' from php file
- 7. appendRow from array
- 8. JavaScript Thumbnails from Array
- 9. OpenCV RGB to gray
- 10. Read RGBA Image OpenCV
- 11. jQuery Image Array
- 12. show image from gridview
- 13. image from parse.com
- 14. libGDX:Drawable from Image
- 15. setState from 2D array - ReactJS
- 16. function delete_item()from array php
- 17. Numpy 2D-Array from Buffer?
- 18. VB6 Open Forms from array
- 19. Android OpenCV convertTo()from CV_32FC4 to CV_8UC4
- 20. array_push from array from odbc connection not working
- 21. Get size image from link
- 22. iphone animation from image set
- 23. longblob base64 image from db
- 24. Image from StorageReference Firebase-Android
- 25. iPhone store image from imageview
- 26. WPF Xaml Image from Converter
- 27. Opencv - circle image warp
- 28. Image Orientation(python + openCV)
- 29. OpenCV cvtColor image truncated
- 30. Opencv Transforming Image