Skip to content

Commit f5b0271

Browse files
committed
full image segmentation checkpoint
1 parent ad214d5 commit f5b0271

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

src/Annotator/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export const Annotator = ({
6363
videoTime = 0,
6464
videoName,
6565
onExit,
66+
mask,
6667
onNextImage,
6768
onPrevImage,
6869
}: Props) => {
@@ -135,6 +136,8 @@ export const Annotator = ({
135136
RegionEditLabel={RegionEditLabel}
136137
alwaysShowNextButton={Boolean(onNextImage)}
137138
alwaysShowPrevButton={Boolean(onPrevImage)}
139+
mask={mask}
140+
// maskVersion={maskVersion}
138141
state={state}
139142
dispatch={dispatch}
140143
/>

src/FullImageSegmentationAnnotator/index.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
import React from "react"
33
import Annotator from "../Annotator"
44

5+
const [width, height] = [200, 200]
6+
7+
// TODO remove this !!!!
8+
const uint8Array = new Uint8ClampedArray(4 * width * height)
9+
10+
for (let ri = 0; ri < width; ri++) {
11+
for (let ci = 0; ci < height; ci++) {
12+
uint8Array[(ri * width + ci) * 4 + 0] = Math.floor(Math.random() * 256)
13+
uint8Array[(ri * width + ci) * 4 + 1] = Math.floor(Math.random() * 256)
14+
uint8Array[(ri * width + ci) * 4 + 2] = Math.floor(Math.random() * 256)
15+
uint8Array[(ri * width + ci) * 4 + 3] = 255
16+
}
17+
}
18+
19+
const imageData = new ImageData(uint8Array, width, height)
20+
// TODO remove this !!!!
21+
522
export default ({ onExit, images }) => {
6-
return <Annotator images={images} onExit={onExit} />
23+
return <Annotator mask={imageData} images={images} onExit={onExit} />
724
}

src/ImageCanvas/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type Props = {
6666

6767
const getDefaultMat = () => Matrix.from(1, 0, 0, 1, -10, -10)
6868

69-
export default ({
69+
export const ImageCanvas = ({
7070
regions,
7171
imageSrc,
7272
videoSrc,
@@ -480,3 +480,5 @@ export default ({
480480
</div>
481481
)
482482
}
483+
484+
export default ImageCanvas

src/ImageMask/index.story.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ImageMask from "./"
99

1010
const [width, height] = [200, 200]
1111

12-
const uint8Array = new Uint8ClampedArray(4 * width * width)
12+
const uint8Array = new Uint8ClampedArray(4 * width * height)
1313

1414
for (let ri = 0; ri < width; ri++) {
1515
for (let ci = 0; ci < height; ci++) {

src/MainLayout/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ type Props = {
3636
alwaysShowPrevButton?: boolean,
3737
}
3838

39-
export default ({
39+
export const MainLayout = ({
4040
state,
4141
dispatch,
4242
alwaysShowNextButton = false,
4343
alwaysShowPrevButton = false,
44+
mask,
4445
RegionEditLabel,
4546
}: Props) => {
4647
const classes = useStyles()
@@ -154,6 +155,7 @@ export default ({
154155
<ImageCanvas
155156
{...settings}
156157
key={state.selectedImage}
158+
mask={mask}
157159
showTags={state.showTags}
158160
allowedArea={state.allowedArea}
159161
regionClsList={state.regionClsList}
@@ -262,3 +264,5 @@ export default ({
262264
</Fullscreen>
263265
)
264266
}
267+
268+
export default MainLayout

0 commit comments

Comments
 (0)