ofImage ofxOpenCV

//-------------------------------------------------------------- void ofApp::setup(){     image1.load("D:/2.bmp");     image1.mirror(FALSE, TRUE);     image1.resize(512, 512);     image1.crop(10, 10, 256, 256);     image1.saveImage("D:/after.png", OF_IMAGE_QUALITY_BEST); } //-------------------------------------------------------------- void ofApp::update(){     } //-------------------------------------------------------------- void ofApp::draw(){     image1.draw(0, 0); }

[C#] Bitmap to 2D Array

double [,] yarray; yarray = new double [160,140]; Bitmap LLL = new Bitmap ( "c:/ProtoA/rL.jpg" ); for (ix = 0; ix < 160; ix++) { for (iy = 0; iy < 140; iy++) { yarray[ix, iy] = .299 * LLL.GetPixel(ix, iy).R + .587 * LLL.GetPixel(ix, iy).G + .114 * LLL.GetPixel(ix, iy).B; } }

3.bmp SSM

이미지
import numpy as np import cv2 WIDTH = 128   # has a great influence on the result if __name__ == '__main__':     img = cv2.imread('/home/jonathan/Pictures/3.bmp', 0)     img = cv2.resize(img, (WIDTH, WIDTH*img.shape[0]/img.shape[1]))     c = cv2.dft(np.float32(img), flags = cv2.DFT_COMPLEX_OUTPUT)     mag = np.sqrt(c[:,:,0]**2 + c[:,:,1]**2)     spectralResidual = np.exp(np.log(mag) - cv2.boxFilter(np.log(mag), -1, (3,3)))     c[:,:,0] = c[:,:,0] * spectralResidual / mag     c[:,:,1] = c[:,:,1] * spectralResidual / mag     c = cv2.dft(c, flags = (cv2.DFT_INVERSE | cv2.DFT_SCALE))     mag = c[:,:,0]**2 + c[:,:,1]**2     cv2.normalize(cv2.GaussianBlur(mag,(9,9),3,3), mag, 0., 1., cv2.NORM_MINMAX)     cv2.imshow('Saliency Map', mag)     c = cv2.waitKey(0) & 0xFF         if(c==27 or c==ord('q')):         cv2.destroyAllWindows()

LenaColor + SSM + Python2 + Ubuntu + OCV2

이미지
import numpy as np import cv2 WIDTH = 128   # has a great influence on the result if __name__ == '__main__':     img = cv2.imread('/home/jonathan/Pictures/lena.bmp', 0)     img = cv2.resize(img, (WIDTH, WIDTH*img.shape[0]/img.shape[1]))     c = cv2.dft(np.float32(img), flags = cv2.DFT_COMPLEX_OUTPUT)     mag = np.sqrt(c[:,:,0]**2 + c[:,:,1]**2)     spectralResidual = np.exp(np.log(mag) - cv2.boxFilter(np.log(mag), -1, (3,3)))     c[:,:,0] = c[:,:,0] * spectralResidual / mag     c[:,:,1] = c[:,:,1] * spectralResidual / mag     c = cv2.dft(c, flags = (cv2.DFT_INVERSE | cv2.DFT_SCALE))     mag = c[:,:,0]**2 + c[:,:,1]**2     cv2.normalize(cv2.GaussianBlur(mag,(9,9),3,3), mag, 0., 1., cv2.NORM_MINMAX)     cv2.imshow('Saliency Map', mag)     c = cv2.waitKey(0) & 0xFF         if(c==27 or c==ord('q')):         cv2.destroyAllWindows()

Run python script in Winform

Hello from Python Call Dir(): [] Print the Path: ['.', 'c:\\users\\bemor\\source\\repos\\wfIronPy1\\wfIronPy1\\bin\\Debug\\Lib', 'c:\\users\\bemor\\source\\repos\\wfIronPy1\\wfIronPy1\\bin\\Debug\\DLLs']

winformPictureBox with ironPython

이미지
#!/usr/bin/ipy import sys import clr clr.AddReference("System.Windows.Forms") clr.AddReference("System.Drawing") from System.Windows.Forms import Application, Form, PictureBox from System.Drawing import Size, Point, Bitmap class IForm(Form):     def __init__(self):         self.Text = 'PictureBox'                 try:             castle = Bitmap('lena512.bmp')         except Exception, e:             print 'Cannot read image file'             print e.msg             sys.exit(1)         pb = PictureBox()         pb.Parent = self         pb.Size = Size(castle.Width, castle.Height)         pb.Location = Point(2, 2)         pb.Image = castle         self.Size = Size(castle.Width, castle.Height)         self.CenterToScreen() Application.Run(IForm())

RadioButton by ironPython

이미지