I'm new to both Stackoverflow and coding in general, but I hope I can find some answers here.
For an assignment in computational art history, I want to find a way in RStudio that can display a specific colour in an image, leaving the rest in greyscale.
Like how this photo looks, only detecting the blue from the image
What I want to end up achieving is uploading an image of a painting, and showing that a specific type of blue (rgb(65,102,245) or 'ultramarine') was used by Johannes Vermeer and locating it on his Girl with the Pearl Earring. I can do it with .tif or any other format.
I've tried RGB rasters like described here but I ended up getting errors when I tried to perform it with my own photo (like "alpha level NA, not in [0,1]"). Perhaps I can try that again and show where I go wrong - but to be frank any help/support is welcome at this point!
Best, Doris
Related
I am loading text from some images. With some of them, I am having problems, with this type of image
library(magick)
library(tesseract)
image_read(fichero.jpg) %>%
tesseract::ocr(engine = tesseract("eng")) %>%
cat()
Result
I am assuming (correct me if not) that tesseract fail because of the low quality of the image (it is a scanned document), and I donĀ“t know if there is a way to make the image better.
I tried also some convultion methods with several kernels, trying to reduce the noise of the photo, but it was worse.
Is there a way to handle this or I have to assume that is not possible to get the text in this quality-images?
Regards
Looking at this with the experience of a photographer rather than as a programmer, I would guess that the poor focus and camera jiggle make this image pretty well unreadable by most OCR options. I just used the OCR in Adobe Acrobat to play with it on my own PC and I could get "FECHA" to recognize, but not "NUMERO" and not any of the numbers.
I pulled it into a photo editor and messed around with the contrast, as sometimes it's possible to convert a grayscale image such as this to pure black-and-white and get rid of some of the fuzziness, but I couldn't produce a readable image in my quick-and-dirty experiment.
So realistically, you'll need images that are scanned/photographed with higher resolution and better contrast to get reliable OCR.
It looks like you are trying to create a cow from ground beef. The big problem is that JPEG is not suited for this type of non-photographic image. Your png looks fine because it is a lossless format.
If you don't want this problem, do not save the files as JPEG.
I use R for my stats analyses and I am trying to use it as well to do some image analyze. I am not an expert in coding or R, but I am trying to learn more. So sorry if my question could sound basic.
I am doing some staining to potato slices, the staining turns my potato slices dark brown in the parts where is the compound I want to see. So I used package "jpeg" and "lessR" This image is what I get using this package so I could have a section of my image analyze to get the RGB values. But I just can make a rectangular section, and like that, I lose parts of my stained image. Is there a way where I can "tell" R to analyze all the slice? My background is whitish.example of one my images
Thank you in advance.
Claudia
Using R, how can I extract from an image file (.png or others are available) , and specifically the one below (you are right, it falls far from the finest embodiment of graphic visualization and best practices!) colors and fonts used? I would like to find them out so I can reproduce exactly the colors used in the bars and the font used in their text labels.
For this question to be meet the standards of reproducibility, it may be necessary for me to provide the .png file, but I do not know how to do that for SO readers. Tell me how, and I will do so. Thanks
So, is there a way to identify the RGB or hex codes of the colors and the font family of the numbers?
The first thing to understand is that PNG is a raster format, so you can only get pixel information (Red, Green, Blue channels) from image, not fonts, shapes, etc. Of course, there's a package for handling PNG format:
install.packages('png')
library('png')
pngImage=readPNG('test.png')
pngImage[293,1,]
# RGBA information of pixel at (1,293)
# [1] 0.09019608 0.13333333 0.20784314 1.00000000
If you want to extract text from the image, you can always use OCR software.
Not really an R problem, but you can get the color easily using this website:
http://www.imagecolorpicker.com/en.
Just put the image url (http://i.stack.imgur.com/00W9N.png) in the box below, and then click to get the HTML/RGB colour code. You can then pass the color to a ggplot function.
For the font, I can't help. You might have luck over at graphic design:
https://graphicdesign.stackexchange.com/questions/tagged/font-identification
So I got some kind of cross section picture in jpg format I want to work with. For better understanding I just drew a picture, hopefully symbolising well enough kinda how the real pictures will look like:
At the top of the picture is material A, at the bottom material B.
Goal: I want to get the Pixels of the boundary line between both materials.
My way so far:
I already know how to read pictures with package called EBImage
I also know, that this will result in a matrix with a color value for
every pixel.
I thought it would be better to convert the jpeg into a binary picture with only black and white colors.
I thought filling up the black part below (Material B) and reducing the noise would be nice, so I could use column sums (a sum of 1's) to find the row number where material A touches material B, which should be my searched boundary line (right?).
Problems:
I don't find filters which fill up the black parts intelligently, in the real pictures, there will be much more noise, which will complicate things even further...
I am not sure if all this is even necessary, and there is a more efficient way to reach my goal of finding the boundary line
Thank you very much for every tip in advance!
Answers will always be vague when there's no example to work with. I would normally use ImageJ for a task like this but EBImage has the commands that I would use.
From EBImage I would make binary and then erode , dilate, and fill holes (fillHull).
Your picture looks like it might be a candidate for a support vector machine. There are a couple of packages for R with svm functions, one is e1071.
Please help me to find nautical charts symbols, used on nautical navigation maps in vector format. I have found following PDF: http://pdept.cgaux.org/Documents/Active/NS/Charts/Chart_No_1_Full.pdf
It contains all symbols I need, but unfortunately they are all in raster.
I take a look to the OpenStreetMap & OpenSeaMap and similar OpenSource projects, but unable to solve my problem. And I feel sense that redrawing such symbols from raster PDF itself is not a good idea and looks like reinventing the wheel...
You already looked at the right places. OpenSeaMap seems to have its SVG icon repository here (recursively browse through the subdirectories, there are multiple icon locations). Furthermore there is a marine tagging proposal in the OpenStreetMap wiki also containing lots of different marine icons in SVG format (also browse through the various links there which might lead to more icons). And then there is FreieTonne, a similar project to OpenSeaMap, for which I couldn't determine the location of their icon set.
In all cases keep the licenses for the specific icon sets in mind.