Image comparison – fast algorithm

Below are three approaches to solving this problem (and there are many others). The first is a standard approach in computer vision, keypoint matching. This may require some background knowledge to implement, and can be slow. The second method uses only elementary image processing, and is potentially faster than the first approach, and is straightforward … Read more

How to embed image or picture in jupyter notebook, either from a local machine or from a web resource?

You mustn’t use quotation marks around the name of the image files in markdown! If you carefully read your error message, you will see the two %22 parts in the link. That is the html encoded quotation mark. You have to change the line !How to embed image or picture in jupyter notebook, either from … Read more

Why does an image captured using camera intent gets rotated on some devices on Android?

Most phone cameras are landscape, meaning if you take the photo in portrait, the resulting photos will be rotated 90 degrees. In this case, the camera software should populate the Exif data with the orientation that the photo should be viewed in. Note that the below solution depends on the camera software/device manufacturer populating the … Read more

Can an ASP.NET MVC controller return an Image?

Use the base controllers File method. public ActionResult Image(string id) { var dir = Server.MapPath(“/Images”); var path = Path.Combine(dir, id + “.jpg”); //validate the path for security or use other means to generate the path. return base.File(path, “image/jpeg”); } As a note, this seems to be fairly efficient. I did a test where I requested … Read more

Formula to determine perceived brightness of RGB color

The method could vary depending on your needs. Here are 3 ways to calculate Luminance: Luminance (standard for certain colour spaces): (0.2126*R + 0.7152*G + 0.0722*B) source Luminance (perceived option 1): (0.299*R + 0.587*G + 0.114*B) source Luminance (perceived option 2, slower to calculate): sqrt( 0.241*R^2 + 0.691*G^2 + 0.068*B^2 ) → sqrt( 0.299*R^2 + … Read more

How do I display local image in markdown?

I suspect the path is not correct. As mentioned by user7412219 ubuntu and windows deal with path differently. Try to put the image in the same folder as your Notebook and use: ![alt text](Isolated.png “Title”) On windows the desktop should be at: C:\Users\jzhang\Desktop

CSS Image size, how to fill, but not stretch?

You can use the css property object-fit. (“sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container.”) .cover { object-fit: cover; width: 50px; height: 100px; } <img src=”http://i.stack.imgur.com/2OrtT.jpg” class=”cover” width=”242″ height=”363″ /> See example here There’s a polyfill for IE: https://github.com/anselmh/object-fit Related: object-position (specifies … Read more

Android: combining text & image on a Button or ImageButton

For users who just want to put Background, Icon-Image and Text in one Button from different files: Set on a Button background, drawableTop/Bottom/Rigth/Left and padding attributes. <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:background=”@drawable/home_btn_test” android:drawableTop=”@drawable/home_icon_test” android:textColor=”#FFFFFF” android:id=”@+id/ButtonTest” android:paddingTop=”32sp” android:drawablePadding=”-15sp” android:text=”this is text”></Button> For more sophisticated arrangement you also can use RelativeLayout (or any other layout) and make it clickable. … Read more

How do I resize an image using PIL and maintain its aspect ratio?

Define a maximum size. Then, compute a resize ratio by taking min(maxwidth/width, maxheight/height). The proper size is oldsize*ratio. There is of course also a library method to do this: the method Image.thumbnail. Below is an (edited) example from the PIL documentation. import os, sys import Image size = 128, 128 for infile in sys.argv[1:]: outfile … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)