jpeg

Access raw YUV values from JPEG with JavaScript

梦想与她 提交于 2019-12-24 04:55:30
问题 I have dynamically loaded a JPEG image into a 2D html canvas and I would like to access the raw YCbCr pixel values. From what I understand, JPEG encodes the pixel data in YCbCr, but chrome appears convert it to RGB when accessing it with getImageData(). I have tried using the RGB to YCbCr conversion calculations but it appears to be a lossy conversion as they don't map perfectly 1-to-1. Is it possible to access the raw YCbCr pixel values in JavaScript? 回答1: Yes and no. When the browser loads

python opencv SIFT doesn't work for 8 bit images (JPEG)

自作多情 提交于 2019-12-24 04:22:16
问题 I used SIFT for all my other 24 bit JPEG images without any problems, however, the 8 bit one always give me this following error. image is empty or has incorrect depth (!=CV_8U) in function cv::SIFT::operator () Does anyone know how to deal with it? Here is my code: import cv2 import numpy as np import os import glob import scipy.cluster os.chdir('\mydirectory') images = [] for infile in glob.glob('./*.jpg'): pic = cv2.imread(infile,0) images.append(pic) my_set = images descriptors = np.array

Why Bitmap.Save changes image's size?

时间秒杀一切 提交于 2019-12-24 03:36:16
问题 I succeeded to change image's DateTaken property. But, after resaving the image, its size changed. I checked with Matlab and both images' bytes are identical. To check whether changing property changes the size I decided just to open the file and save it without changing any properties. The code is below: using (var image = new Bitmap(@"C:\Temp\1.jpg")) { image.Save(@"C:\Temp\2.jpg"); } But, the size still changed. The size of the original jpeg image 1.jpg is 1.88 MB (1,975,162 bytes) . After

getting mulitple images from a single stream piped from ffmpeg stdout

冷暖自知 提交于 2019-12-24 03:12:50
问题 I start a process to retrieve a few frames from a video file with ffmpeg, ffmpeg -i "<videofile>.mp4" -frames:v 10 -f image2pipe pipe:1 and pipe the images to stdout - var cmd = Process.Start(p); var stream = cmd.StandardOutput.BaseStream; var img = Image.FromStream(stream); Getting the first image this way works, but how do I get all of them? 回答1: OK this was gobspackingly easy, kind of embarrassed I asked here. I'll post the answer in case it will help anyone else. The first few bytes in

getting mulitple images from a single stream piped from ffmpeg stdout

纵饮孤独 提交于 2019-12-24 03:12:06
问题 I start a process to retrieve a few frames from a video file with ffmpeg, ffmpeg -i "<videofile>.mp4" -frames:v 10 -f image2pipe pipe:1 and pipe the images to stdout - var cmd = Process.Start(p); var stream = cmd.StandardOutput.BaseStream; var img = Image.FromStream(stream); Getting the first image this way works, but how do I get all of them? 回答1: OK this was gobspackingly easy, kind of embarrassed I asked here. I'll post the answer in case it will help anyone else. The first few bytes in

HTML image tag with base64 string (data URI)

[亡魂溺海] 提交于 2019-12-24 01:52:37
问题 I get binary data of jpeg images from a series of httprequests about every 50-200 ms, I convert this data to a base64 string and insert the string in the img tag with javascript. var img = document.getElementById('img1'); img.src = 'data:image/jpeg;base64,' + b64str + ''; So when receiving greater pics, I experience that the image (first displayed fully) after some seconds get cut down from the bottom more and more until it reaches a certain point. I searched a bit and found Internet Explorer

libjpeg and lossless JPEG

旧巷老猫 提交于 2019-12-24 01:37:17
问题 I have a question regarding DICOM standard and libjpeg library. In the DICOM standard, there are, among others, Transfer Syntax: JPEG Lossless, Nonhierarchical, First- Order Prediction (Processes 14 [Selection Value 1]): Default Transfer Syntax for Lossless JPEG Image Compression As far as I know, this Transfer Syntax corresponds with JPEG-1 Lossles format. I started researching libjpeg library and I found out that it doesn't support (?) Lossless JPEG, as stated here: JPEG Lossless in DICOM

put jpg data from xmlhttprequest into <img /> tag

时光怂恿深爱的人放手 提交于 2019-12-24 00:50:20
问题 here is some part of my code xmlhttp.open("GET", theUrl, true); document.imglive.innerHTML = '<img src="data:image/jpeg,' + xmlhttp.responseText + '"/>'; that don´t seem to work. i also tried document.imglive.src= xmlhttp.responseText; that neither worked I checked some of the asked questions here but none of the answers where helping at this porblem. 回答1: Use base64 for these things. In modern browsers there's this btoa native function that may help you: document.imglive.innerHTML = "<img

PHP image uploader not working with Capital JPG extension

心已入冬 提交于 2019-12-24 00:34:05
问题 Thanks in advance. I have a php image uploader that I built, which is working just fine. However I tried uploading a .JPG extension image and it did not work. Please note I mean capital JPG and not lowercase jpg. .png, .jpg, .gif all work fine and get uploaded, the thumbnails are created and what not. It is the capital .JPG that isn't working for some reason. See my code below. Is it a different mime type? The queries (which I removed for security purposes) work just fine. The information is

How can I read JPEG EXIF orientation tags in a MS Word macro?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 00:24:52
问题 I have a Word macro that opens all the JPEGs in a particular folder, and inserts them into the document. The problem is the orientation. My macro reads the width vs. length to determine the orientation. But Word inserts the image according to the EXIF orientation tag, and Windows 10 rotates by the EXIF orientation tag. That means I have no real way of controlling the rotation of the image in the document. How can a Word macro read the EXIF orientation tag of a JPEG? 来源: https://stackoverflow