Remove any bones and skin from the trout fillets if needed, then roughly chop the fish.
Heat the olive oil in a frying pan over medium heat. Add the onions, peppers, and garlic, and cook until tender, about 3 to 5 minutes. Season to taste with salt and pepper. Transfer to a plate and let cool.
In a large bowl, combine the cooked vegetables with the remaining ingredients, except the masa harina (or flour, if using) and the frying oil. Mix well, then refrigerate for 30 minutes.
Form into cakes and dust each side lightly with masa harina or flour. Place in the refrigerator for 30 minutes to rest.
Heat a large skillet over medium-high heat and add enough oil to fill the bottom of the pan by about 1/4 inch.
Fry the cakes about 5 minutes per side, or until golden brown. Work in batches if needed.
Transfer to paper towels. Season lightly with salt and black pepper.