Image.Horizo​​ntalResolution和Image.VerticalResolution-为什么浮动? [英] Image.HorizontalResolution and Image.VerticalResolution - why float?

查看:68
本文介绍了Image.Horizo​​ntalResolution和Image.VerticalResolution-为什么浮动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

部分原因是出于好奇,部分原因是可以证明如何在SQL Server数据库中存储决策:

This is partly out of curiosity and partly to be able to justify decision how to store in SQL Server database:

为什么Image.HorizontalResolutionImage.VerticalResolution具有浮点数类型? "infinity"和"NaN"如何发挥作用?

Why Image.HorizontalResolution and Image.VerticalResolution have type of floating-point number? How does "infinity" and "NaN" play into this?

参考:图像.Horizo​​ntalResolution属性

推荐答案

这个问题的实际答案是浮点数,因为美国不使用公制,它以英寸为单位.世界其他地方使用电表.一米中有25.4英寸不会产生漂亮的整数.图像文件格式使用不同的标准,具有讽刺意味的是,最常见的使用米而不是英寸的图像格式是由一家美国公司创建的. BMP文件格式使用每米像素.

The somewhat practical answer to this question is that it is a float because the USA does not use the metric system, it measures in inches. Rest of the world uses meters. Having 25.4 inches in a meter does not produce nice round numbers. Image file formats use different standards, somewhat ironically the most common image format that uses meters instead of inches was created by an American company. The BMP file format uses pixels-per-meter.

在技术上更正确的答案也许是,分辨率是用于创建图像的图像传感器的设计参数.物理特性,例如CCD传感器中单元的间距.并受用于将场景投射到传感器上的镜头的影响.传感器和透镜都不一定要具有每英寸均匀可整除的数字.或每米.芯片烘烤工厂使用以米为单位测量的特征尺寸.好吧,纳米.而且镜头的焦距通常是可调的,而图像处理器并不能解决这个问题.

The more technically correct answer, perhaps, is that the resolution is a design parameter of the image sensor that was used to create the image. A physical property, like the spacing of the cells in a CCD sensor. And affected by the lens used to project the scene onto the sensor. Neither the sensor nor the lens are necessarily created with an evenly divisible number per inch. Or per meter. Chip baking factories use feature sizes that are measured in meters. Well, nanometers. And the focal length of the lens is often adjustable and the image processor does not account for that.

因此实际上它是只是一个参考数字和选择的实际值是一个很好的以英寸为单位的整数,它与图像中的像素数成正比.它可以确保您可以在物理尺寸大致相同的另一台设备(例如打印机)上再现图像.非常常见的值是72和96,这是监视器的默认值(与监视器大小无关),也是使用绘画程序创建图像时获得的默认值. 300和600是常见的,分辨率较低的扫描仪.保持与您花费的金额成正比的两倍.

So in practice it is just a reference number and the actual value picked is a nice round number in inches that's proportional to the number of pixels in the image. It ensures that you have a shot at reproducing the image on another device, like a printer, with roughly the same physical size. Very common values are 72 and 96, the default value for monitors (regardless of the monitor size) and the one you get when you created the image with a painting program. 300 and 600 are common, the resolution of cheap scanners. Keep doubling it proportional to the amount of money you spent.

我唯一一次看到它是一个小数点是在一个hokey图像转换程序中,它扰乱了米到英寸的转换.截断它而不是舍入它.四舍五入时,将其作为整数存储在dbase中是可以的.它永远不会是无穷大或NaN.

The only time I've ever seen it as a fractional number was in a hokey image conversion program that flubbed the meter-to-inch conversion. Truncating it instead of rounding it. Storing it in the dbase as an integer is fine when you round. It is never infinity or NaN.

这篇关于Image.Horizo​​ntalResolution和Image.VerticalResolution-为什么浮动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆