You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Siddharth Murching (JIRA)" <ji...@apache.org> on 2018/01/24 22:41:00 UTC
[jira] [Commented] (SPARK-23205) ImageSchema.readImages incorrectly
sets alpha channel to 255 for four-channel images
[ https://issues.apache.org/jira/browse/SPARK-23205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16338360#comment-16338360 ]
Siddharth Murching commented on SPARK-23205:
--------------------------------------------
Working on a PR to address this issue
> ImageSchema.readImages incorrectly sets alpha channel to 255 for four-channel images
> ------------------------------------------------------------------------------------
>
> Key: SPARK-23205
> URL: https://issues.apache.org/jira/browse/SPARK-23205
> Project: Spark
> Issue Type: Bug
> Components: ML, MLlib
> Affects Versions: 2.3.0
> Reporter: Siddharth Murching
> Priority: Critical
>
> When parsing raw image data in ImageSchema.decode(), we use a [java.awt.Color constructor|https://docs.oracle.com/javase/7/docs/api/java/awt/Color.html#Color(int)] that sets alpha = 255, even for four-channel images.
> See the offending line here: https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/image/ImageSchema.scala#L172
> A fix is to simply update the line to:
> val color = new Color(img.getRGB(w, h), nChannels == 4)
> instead of
> val color = new Color(img.getRGB(w, h))
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org