思前想后是什么意思| 脖子左侧疼是什么原因| 808什么意思| 懿是什么意思| 小孩心肌炎有什么症状| 喝什么去湿气| 北京的市花是什么| 贾宝玉大名叫什么| 老年人腿无力是什么原因导致的| 什么钓鱼愿者上钩| 是故是什么意思| 老舍为什么自杀| 肾虚吃什么药| 6.28什么星座| 生理期吃什么| 怀孕查甲功是什么意思| 手心痒是什么原因| 酿酒用什么菌| 遥遥相望是什么意思| 鼾症是什么病| hcg高是什么原因| 尿常规白细胞3个加号什么意思| 为什么男人喜欢邓文迪| 日本的町是什么意思| 刚愎自用是什么生肖| 自荐是什么意思| dj管是什么| 载歌载舞的载是什么意思| 绞丝旁奇念什么| 政治庇护是什么意思| 梦见和别人打架是什么意思| 羡慕的什么| 什么是漂洗| 匮乏是什么意思| 开口腔诊所需要什么条件| 觉是什么偏旁| 小样什么意思| 拉肚子吃什么饭| 法国鳄鱼属于什么档次| 党的性质是什么| 捌是什么数字| 吃白糖有什么好处和坏处| 黄精泡酒有什么功效| 吃的多拉的少是什么原因| 巧克力有什么功效与作用| 燕窝什么人不适合吃| 渗透压是什么意思| 什么是发票抬头| 睾丸扭转是什么意思| 世袭制是什么意思| 肝脏多发囊肿什么意思| 大校军衔相当于什么官| 为什么腋下老是出汗| 什么样的人不容易怀孕| 貔貅是什么动物| 两女 一杯是什么| 低压高什么原因导致的| 粉玫瑰花语是什么意思| diamond是什么牌子| 血红蛋白低是什么原因| 子宫前位什么姿势易孕| 慢热型是什么意思| 腿走路没劲发软是什么原因| 什么是三界五行| 1983属什么生肖| 手关节疼痛挂什么科| 人咬人有什么危害| 尿频吃什么药效果最好| 胃溃疡不能吃什么食物| 小孩记忆力差需要补充什么营养| 什么像什么| 7月16日什么星座| 诸葛亮老婆叫什么名字| 室早三联律是什么意思| 头三个月保胎喝什么汤| 海鲜不能和什么食物一起吃| 考研要考什么| 焦糖色裤子配什么颜色上衣| 政绩是什么意思| 什么情况下需要根管治疗| 入睡困难是什么原因| 梦见孩子被蛇咬是什么意思| 大腿青筋明显是什么原因| 手指脱皮是什么原因造成的| 可喜可贺是什么意思| 做爱女生什么感觉| 千里走单骑是什么意思| 抹茶色是什么颜色| 香港五行属什么| 咨询什么意思| 痔疮用什么药| 彼岸花开是什么意思| 三月十五是什么星座| 多囊性改变是什么意思| 肠胃炎是什么引起的| 吃什么水果对子宫和卵巢好| 约会什么意思| ck是什么意思| 心境情感障碍是什么病| 奇异是什么意思| 胆结石不能吃什么食物| 黑枸杞泡水是什么颜色| 女性睾酮低说明什么| 食道肿瘤有什么症状| 什么叫尊重| 女生为什么会来月经| 女人出黄汗是什么原因| 节操是什么意思| 台湾高山茶属于什么茶| 香蕉皮擦脸有什么作用与功效| 驾校体检都检查什么| 烫伤什么时候能好| 什么药护肝效果最好| 无的放矢是什么意思| 英雄是什么生肖| 运钞车押运员是什么人| 褐色是什么颜色| 肾上腺素是什么意思| 耳道炎用什么药最有效| 自信过头叫什么| 什么是乳腺增生| 黄金为什么值钱| 月经为什么是黑色的| 莆田系是什么意思啊| 钯金是什么金| 见利忘义是什么生肖| 生命是什么意思| fat是什么意思| 晚餐吃什么健康又营养| 阴道有灼热感是什么原因| 肋骨属于什么骨| 手掌脱皮是什么原因| 切口憩室是什么意思| 古代的天花是现代的什么病| 丝状疣是什么原因长出来的| 张嘴睡觉是什么原因| 为什么硬不起来| society是什么意思| 泄露是什么意思| 天空什么的什么的| 粉色玫瑰花代表什么意思| 九头身什么意思| 功劳叶的别名叫什么| 腈纶是什么面料优缺点| 胎毛什么时候剃最好| 牙周炎吃什么消炎药| 石英岩玉是什么| 送女朋友什么礼物好| 脂肪肝喝什么茶最好| 宠物蛇吃什么| 全麦面包是什么意思| 芡实是什么| 三观是什么意思| 肝肾阴虚吃什么中成药| soleil是什么意思| 活塞运动是什么| 珍珠母贝是什么东西| 耳鸣是什么病引起的| 阴蒂瘙痒是什么原因| 取环后需要注意什么| 跑步腰疼是什么原因| 银鱼是什么鱼| 夏威夷果吃了有什么好处| 彩字五行属什么| 含量是什么意思| 喝咖啡要注意什么| 鸡婆是什么意思| 菠萝蜜什么季节成熟| 小腿肌肉痛什么原因| 心率低有什么症状| 万里长城是什么生肖| 流水席是什么意思| 喝什么茶不影响睡眠| 精字五行属什么| 鲁冰花是什么意思| mchc偏低是什么意思| 老年人脚肿挂什么科| 女人吃藕有什么好处| 福禄是什么意思| 7.28是什么星座| gary是什么意思| 胎儿股骨长是什么意思| 孕妇喝什么牛奶好| 麦粒肿挂什么科| 异禀是什么意思| 四川有什么好大学| 1953年属什么| 为什么腹水会很快死亡| 心律失常是什么症状| 陕西有什么烟| 国安局是什么单位| 苯佐卡因是什么药| 夏枯草是什么样子| 嗜的意思是什么| 狗不能吃什么| 吉利丁片是什么做的| 什么是畸胎瘤| 舌头白腻厚苔是什么原因| marlboro是什么烟| 为什么会气血不足| 吐血拉血是什么病的症状| 子宫直肠凹积液是什么意思| 日落西山是什么生肖| 做梦梦到男朋友出轨了是什么意思| 什么人适合喝三七粉| 咳嗽打什么点滴效果好| 乳房胀痛是什么原因引起的| 包皮什么年龄割最好| lp0是什么意思| 邹字五行属什么| 痔疮是什么症状| 盐酸达泊西汀片是什么药| 略施小计是什么动物| 为什么会突然吐血| 寻麻疹吃什么药| 阴虱用什么药最有效| 92年是什么年| 急支糖浆是什么梗| 腿水肿是什么原因引起的| 狗不能吃什么水果| 合拢是什么意思| 圆脸适合什么刘海| 肾低密度灶是什么意思| 学痞是什么意思| 为什么叫黄瓜| 211和985什么意思| hi什么意思| 四肢冰凉是什么原因| 82年的拉菲是什么意思| 高血压挂什么科| 月光石五行属什么| 小孩牙疼有什么办法| 中医行业五行属什么| exr是什么牌子| 月字旁与什么有关| 肚子疼应该挂什么科| 净值是什么| 针灸有什么作用| 清新的什么| 乖巧是什么意思| 黄糖是什么糖| 叶酸片是治什么的| 什么网名好听又有内涵| 鼓动是什么意思| 缺钠是什么原因造成的| 什么防辐射最好| hpv病毒是什么病毒| 安络血又叫什么名| Rm是什么| 中国的国粹是什么| 脖子淋巴结发炎吃什么药| 姑姑的儿子叫什么| 肚子左侧疼是什么原因| 核磁共振跟ct有什么区别| 25岁属什么| 眉什么眼什么| 鼻头发黑是什么原因| 青椒是什么意思| 什么是双相情感障碍| 蛔虫是什么动物| 什么花香| 术后血压低什么原因| 产妇吃什么下奶快又多| 阴郁是什么意思| 百度
 

法国 南部连环恐袭 英勇受伤宪兵中校不治身亡

百度 ”  (新华社北京3月19日电)  

We explain how to easily access and manipulate the internal components of digital images using Python and give examples from satellite image processing.



This blog is a continuation of Basic Image Data Analysis Using Numpy and OpenCV – Part 1.

Use logical Operator to Process Pixel Values

We can create a bullion ndarray in the same size by using a logical operator. However, this won’t create any new array but it simply returns True to its host variable. For example: let’s consider we want to filter out some low value pixel or high value or (any condition) in an RGB image and yes it would be great to convert RGB to gray scale but for now we won’t go for that rather than deal with color image.

Let’s first load an image and show it on screen.

pic=imageio.imread('F:/demo_1.jpg')

plt.figure(figsize=(10,10))

plt.imshow(pic)

plt.show()

Demo figure 1
OK, let’s consider this dump image. Now, for any case we want to filter out all the pixel value which is below than, let’s assume 20. For this we’ll use logical operator to do this task which we’ll return as a value of True for all the index.

low_pixel=pic<20 

# to ensure of it let's check if all values 
in low_pixel are True or not

iflow_pixel.any()==True:
print(low_pixel.shape)

(1079, 1293, 3)

Now as we said, a host variable, well this name is not traditionally used but i refer it because it behaves. It just holds the True value and nothing else. So, if we see the shape of both low_pixel and pic , we’ll find that both have the same shape.

print(pic.shape)
(1079,1293,3)

print(low_pixel.shape) 
(1079,1293,3)

We generated that low value filter using a global comparison operator for all the values less than 200. However, we can use this low_pixel array as an index to set those low values to some specific values which may be higher than or lower than the previous pixel value.

# randomly choose a value 

importrandom 

# load the original image

pic=imageio.imread('F:/demo_1.jpg') 

# set value randomly range from 25 to 225 - 
these value also randomly chosenpic[low_pixel]=random.randint(25,225) 

# display the image

plt.figure(figsize=(10,10))

plt.imshow(pic)plt.show()
Demo figure 2

Masking

Image masking is an image processing technique that is used to remove the background from which photographs those have fuzzy edges, transparent or hair portions.

Now, we’ll create a mask that is in shape of a circular disc. First we’ll measure distance from center of the image to every border pixel values. And we take a convenient radius value and then using logical operator we’ll create a circular disc. It’s quite simple, let’s see the code.

if__name__=='__main__': 
# load the image
pic=imageio.imread('F:/demo_1.jpg') 
# separate the row and column values
total_row,total_col,layers=pic.shape 
'''   Create vector. 
Ogrid is a compact method of creating a multidimensional-
ndarray operations in single lines.   
for ex: 
>>>ogrid[0:5,0:5]   
output: 
[array([[0],[1],[2],[3],[4]]), 
array([[0, 1, 2, 3, 4]])]    
'''
x,y=np.ogrid[:total_row,:total_col] 
# get the center values of the image
cen_x,cen_y=total_row/2,total_col/2  
'''   
Measure distance value from center to each border pixel.   
To make it easy, we can think it's like, we draw a line from center-   
to each edge pixel value --> s**2 = (Y-y)**2 + (X-x)**2    '''
distance_from_the_center=np.sqrt((x-cen_x)**2+(y-cen_y)**2) 
# Select convenient radius value
radius=(total_row/2) 
# Using logical operator '>' 
'''   logical operator to do this task which will 
return as a value    of True for all the index according to the 
given condition   '''
circular_pic=distance_from_the_center>radius 
'''
let assign value zero for all pixel value that outside 
the circular disc.   All the pixel value outside the circular 
disc, will be black now.   
'''
pic[circular_pic]=0
plt.figure(figsize=(10,10))
plt.imshow(pic)
plt.show()
Demo figure 3

Satellite Image Processing

One of MOOC course on edX, we’ve introduced with some satellite images and its processing system. It’s very informative of course. However, let’s do a few analysis task on it.

# load the image
pic=imageio.imread('F:\satimg.jpg')
plt.figure(figsize=(10,10))
plt.imshow(pic)
plt.show()
Demo figure 4

Let’s see some basic info of it.

print(f'Shape of the image {pic.shape}')

print(f'hieght {pic.shape[0]} pixels')

print(f'width {pic.shape[1]} pixels') 

Shapeoftheimage(3725,4797,3)

height 3725 pixels

width 4797 pixels

Now, There’s something interesting about this image. Like many other visualizations, the colors in each rgb layer mean something. For example, the intensity of the red will be an indication of altitude of the geographical data point in the pixel. The intensity of blue will indicate a measure of aspect and the green will indicate slope. These colors will help to communicate this information in a quicker and more effective way rather than showing numbers.

  • Red pixel indicates: Altitude
  • Blue pixel indicates: Aspect
  • Green pixel indicates: Slope

There is, by just looking at this colorful image, a trained eye can tell already what the altitude, what’s the slope, what’s the aspect. So that’s the idea of loading some more meaning to these colors to indicate something more scientific.

Detecting High Pixel of Each Channel

# Only Red Pixel value , higher than 180

pic=imageio.imread('F:\satimg.jpg')

red_mask=pic[:,:,0]<180 

pic[red_mask]=0

plt.figure(figsize=(15,15))

plt.imshow(pic)  

# Only Green Pixel value , higher than 180

pic=imageio.imread('F:\satimg.jpg')

green_mask=pic[:,:,1]<180 

pic[green_mask]=0

plt.figure(figsize=(15,15))

plt.imshow(pic)  

# Only Blue Pixel value , higher than 180

pic=imageio.imread('F:\satimg.jpg')

blue_mask=pic[:,:,2]<180 

pic[blue_mask]=0

plt.figure(figsize=(15,15))

plt.imshow(pic) 

# Composite mask using logical_and

pic=imageio.imread('F:\satimg.jpg')

final_mask=np.logical_and(red_mask,green_mask,blue_mask)

pic[final_mask]=40

plt.figure(figsize=(15,15))

plt.imshow(pic)

Demo figure 5
Bio: Mohammed Innat is currently a fourth year undergraduate student majoring in electronics and communication. He is passionate about applying his knowledge of machine learning and data science to areas in healthcare and crime forecast where better solutions can be engineered in medical sector and security department.

Related:



两面性是什么意思 黄鼻涕是什么原因 王大治与董洁什么关系 人的脾脏起什么作用 造口是什么
优雅是什么意思 恏是什么意思 牡丹鹦鹉吃什么 九加虎念什么 尿酸高是什么
什么叫非萎缩性胃炎 为什么鱼和熊掌不可兼得 肺气虚吃什么食物 痔疮不能吃什么东西 荣誉的誉是什么意思
迷津是什么意思 碱性磷酸酶偏高吃什么能降下来呢 间隙是什么意思 什么是马上风 有什么好吃的家常菜
panerai是什么牌子hcv8jop7ns3r.cn 鹿吃什么hcv9jop6ns4r.cn 电饭锅内胆什么材质好1949doufunao.com 什么是平板电脑hcv7jop6ns6r.cn 乳头痛是什么征兆hcv8jop5ns2r.cn
圆脸适合什么发型好看hcv9jop4ns6r.cn 大侠是什么意思hcv8jop3ns0r.cn 生气发抖是什么原因hcv8jop4ns9r.cn 罗贯中是什么朝代的hcv8jop7ns7r.cn 肚脐下面是什么部位hcv9jop5ns1r.cn
女鼠和什么属相最配对hcv9jop6ns4r.cn 荷叶茶有什么作用hcv8jop3ns0r.cn 八字中的印是什么意思hcv9jop4ns7r.cn 为什么长痣hcv7jop4ns7r.cn 什么叫生理盐水xinjiangjialails.com
鸡蛋为什么不能放冰箱hcv8jop4ns0r.cn 弼马温是什么意思hcv9jop6ns3r.cn 下身灼热感什么原因hcv9jop0ns2r.cn 脸上为什么长斑hcv9jop7ns3r.cn 海蜇丝是什么做的0735v.com
百度