-
Notifications
You must be signed in to change notification settings - Fork 830
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3dd0ef
commit a3ab017
Showing
42 changed files
with
940 additions
and
1,000 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in project root for information. | ||
|
||
package com.microsoft.ml.spark | ||
|
||
import org.apache.spark.ml.image.ImageSchema | ||
import org.apache.spark.sql.types._ | ||
|
||
object ImageSchemaUtils { | ||
|
||
val columnSchemaNullable = { | ||
StructType( | ||
StructField("origin", StringType, true) :: | ||
StructField("height", IntegerType, true) :: | ||
StructField("width", IntegerType, true) :: | ||
StructField("nChannels", IntegerType, true) :: | ||
// OpenCV-compatible type: CV_8UC3 in most cases | ||
StructField("mode", IntegerType, true) :: | ||
// Bytes in OpenCV-compatible order: row-wise BGR in most cases | ||
StructField("data", BinaryType, true) :: Nil) | ||
} | ||
|
||
val imageSchemaNullable = StructType(StructField("image", columnSchemaNullable, true) :: Nil) | ||
|
||
def isImage(dataType: DataType): Boolean = { | ||
dataType == ImageSchema.columnSchema || | ||
dataType == columnSchemaNullable | ||
} | ||
|
||
def isImage(dataType: StructField): Boolean = { | ||
isImage(dataType.dataType) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.