How to convert image to black and white using Java

I guess it depends on what you mean by “mono-chrome”https://stackoverflow.com/”black & white”… public class TestBlackAndWhite { public static void main(String[] args) { new TestBlackAndWhite(); } public TestBlackAndWhite() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { } JFrame frame = new JFrame(“Test”); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); … Read more

How do I load and edit a bitmap file at the pixel level in Swift for iOS?

This is how I am getting a color from an image at a touch location. I translated this answer: https://stackoverflow.com/a/12579413/359578 (This sample does no error checking for nil) func createARGBBitmapContext(inImage: CGImage) -> CGContext { var bitmapByteCount = 0 var bitmapBytesPerRow = 0 //Get image width, height let pixelsWide = CGImageGetWidth(inImage) let pixelsHigh = CGImageGetHeight(inImage) // … Read more

Find corner of papers

Take for reference my original code, which simply detects squares on an image. That means that in the main method of the application you would write something like the following pseudo-code to call find_squares(): Mat image = imread(“test.jpg”, 1); // Detect all regions in the image that are similar to a rectangle vector<vector<Point> > squares; … Read more

How to detect ellipses in image without using fitEllipse() in opencv?

As you already got, you don’t need ellipse fitting, but ellipse detection. You can find in my other answer two papers with C++ code available. I’ll report here for completeness: L. Libuda, I. Grothues, K.-F. Kraiss, Ellipse detection in digital image data using geometric features, in: J. Braz, A. Ranchordas, H. Arajo, J. Jorge (Eds.), … Read more

Merge two PNG images with PHP GD library

$image1 = imagecreatefrompng(‘a.png’); //300 x 300 $image2 = imagecreatefrompng(‘b.png’); //150 x 150 imagecopymerge($image1, $image2, 0, 0, 75, 75, 150, 150, 50); this should be all you need. $image1 should hold the merged image where image2 has been overlayed with 50% opacity. the last argument is the alpha of the merged copy. http://php.net/manual/en/function.imagecopymerge.php